public function prime($primer = true)
    {
        if (!is_bool($primer) && !is_callable($primer)) {
            throw new \InvalidArgumentException('$primer is not a boolean or callable');
        }

        if ($primer === false) {
            unset($this->getExpr()->qb->primers[$this->getExpression()]);

            return $this;
        }

        $this->getExpr()->qb->primers[$this->getDotSyntax()] = $primer;

        return $this;
    }
public function prime($primer = true)
    {
        if (!is_bool($primer) && !is_callable($primer)) {
            throw new \InvalidArgumentException('$primer is not a boolean or callable');
        }

        if ($primer === false) {
            unset($this->getExpr()->qb->primers[$this->getExpression()]);

            return $this;
        }

        $this->getExpr()->qb->primers[$this->getDotSyntax()] = $primer;

        return $this;
    }
public function prime ( $ primer = true ) { if ( ! is_bool ( $ primer ) && ! is_callable ( $ primer ) ) { throw new \ InvalidArgumentException ( '$primer is not a boolean or callable' ) ; } if ( $ primer === false ) { unset ( $ this -> getExpr ( ) -> qb -> primers [ $ this -> getExpression ( ) ] ) ; return $ this ; } $ this -> getExpr ( ) -> qb -> primers [ $ this -> getDotSyntax ( ) ] = $ primer ; return $ this ; }
Use a primer to eagerly load all references in this path segment.

If $primer is true or a callable is provided, referenced documents for
this attribute will loaded into UnitOfWork immediately after the query is
executed. This will avoid multiple queries due to lazy initialization of
Proxy objects.

If $primer is false, no priming will take place. That is also the default
behavior.

If a custom callable is used, its signature should conform to the default
Closure defined in {@link ReferencePrimer::__construct()}.

@param bool|callable $primer

@return $this

@throws \InvalidArgumentException If $primer is not boolean or callable.
Use a primer to eagerly load all references in this path segment .