public function contain($associations = null, $override = false)
    {
        $loader = $this->getEagerLoader();
        if ($override === true) {
            $this->clearContain();
        }

        if ($associations === null) {
            deprecationWarning(
                'Using Query::contain() as getter is deprecated. ' .
                'Use getContain() instead.'
            );

            return $loader->getContain();
        }

        $queryBuilder = null;
        if (is_callable($override)) {
            $queryBuilder = $override;
        }

        if ($associations) {
            $loader->contain($associations, $queryBuilder);
        }
        $this->_addAssociationsToTypeMap(
            $this->getRepository(),
            $this->getTypeMap(),
            $loader->getContain()
        );

        return $this;
    }