src/ORM/LazyLoadEntityTrait.php
protected function _lazyLoad($property)
    {
        // check if the property has been unset at some point
        if (array_search($property, $this->_unsetProperties) !== false) {
            return null;
        }

        // check if the property was set as null to begin with
        if (array_key_exists($property, $this->_properties)) {
            return $this->_properties[$property];
        }

        $repository = $this->_repository($property);
        if (!($repository instanceof RepositoryInterface)) {
            return null;
        }

        $association = $repository
            ->associations()
            ->getByProperty($property);

        if ($association === null) {
            return null;
        }

        $repository->loadInto($this, [$association->getName()]);

        // check if the association didn't exist and therefore didn't load
        if (!isset($this->_properties[$property])) {
            return null;
        }

        return $this->_properties[$property];
    }
protected function _lazyLoad($property)
    {
        // check if the property has been unset at some point
        if (array_search($property, $this->_unsetProperties) !== false) {
            return null;
        }

        // check if the property was set as null to begin with
        if (array_key_exists($property, $this->_properties)) {
            return $this->_properties[$property];
        }

        $repository = $this->_repository($property);
        if (!($repository instanceof RepositoryInterface)) {
            return null;
        }

        $association = $repository
            ->associations()
            ->getByProperty($property);

        if ($association === null) {
            return null;
        }

        $repository->loadInto($this, [$association->getName()]);

        // check if the association didn't exist and therefore didn't load
        if (!isset($this->_properties[$property])) {
            return null;
        }

        return $this->_properties[$property];
    }
protected function _lazyLoad ( $ property ) { // check if the property has been unset at some point if ( array_search ( $ property , $ this -> _unsetProperties ) !== false ) { return null ; } // check if the property was set as null to begin with if ( array_key_exists ( $ property , $ this -> _properties ) ) { return $ this -> _properties [ $ property ] ; } $ repository = $ this -> _repository ( $ property ) ; if ( ! ( $ repository instanceof RepositoryInterface ) ) { return null ; } $ association = $ repository -> associations ( ) -> getByProperty ( $ property ) ; if ( $ association === null ) { return null ; } $ repository -> loadInto ( $ this , [ $ association -> getName ( ) ] ) ; // check if the association didn't exist and therefore didn't load if ( ! isset ( $ this -> _properties [ $ property ] ) ) { return null ; } return $ this -> _properties [ $ property ] ; }
Lazy loads association data onto the entity

@param string $property Property
@return mixed
Lazy loads association data onto the entity