src/Rails/ActiveRecord/Base/Methods/AssociationsMethodsTrait.php
public function getAssociation($name, $autoLoad = true)
    {
        if (isset($this->loadedAssociations[$name])) {
            return $this->loadedAssociations[$name];
        } elseif ($autoLoad && $this->getAssociations()->exists($name)) {
            $this->loadedAssociations[$name] =
                $this->getAssociations()->load($this, $name);
            return $this->loadedAssociations[$name];
        }
        return null;
    }
public function getAssociation($name, $autoLoad = true)
    {
        if (isset($this->loadedAssociations[$name])) {
            return $this->loadedAssociations[$name];
        } elseif ($autoLoad && $this->getAssociations()->exists($name)) {
            $this->loadedAssociations[$name] =
                $this->getAssociations()->load($this, $name);
            return $this->loadedAssociations[$name];
        }
        return null;
    }
public function getAssociation ( $ name , $ autoLoad = true ) { if ( isset ( $ this -> loadedAssociations [ $ name ] ) ) { return $ this -> loadedAssociations [ $ name ] ; } elseif ( $ autoLoad && $ this -> getAssociations ( ) -> exists ( $ name ) ) { $ this -> loadedAssociations [ $ name ] = $ this -> getAssociations ( ) -> load ( $ this , $ name ) ; return $ this -> loadedAssociations [ $ name ] ; } return null ; }
If the association isn't yet loaded, it is loaded and returned.
If the association doesn't exist, `null` is returned. Note that
unset one-to-one associations return `false`.

return null|false|object
If the association isn t yet loaded it is loaded and returned . If the association doesn t exist null is returned . Note that unset one - to - one associations return false .