src/Oss2/Doctrine2/WithPreferences.php
public function loadPreference( $name, $index = null, $includeExpired = false )
    {
        foreach( $this->getPreferences() as $pref )
        {
            if( ( $pref->getName() == $name ) && ( $pref->getIx() === $index ) )
            {
                if( $includeExpired || !$pref->getExpiresAt() || ( $pref->getExpiresAt() > new \DateTime() ) )
                    return $pref;

                return false;
            }
        }

        return false;
    }
public function loadPreference( $name, $index = null, $includeExpired = false )
    {
        foreach( $this->getPreferences() as $pref )
        {
            if( ( $pref->getName() == $name ) && ( $pref->getIx() === $index ) )
            {
                if( $includeExpired || !$pref->getExpiresAt() || ( $pref->getExpiresAt() > new \DateTime() ) )
                    return $pref;

                return false;
            }
        }

        return false;
    }
public function loadPreference ( $ name , $ index = null , $ includeExpired = false ) { foreach ( $ this -> getPreferences ( ) as $ pref ) { if ( ( $ pref -> getName ( ) == $ name ) && ( $ pref -> getIx ( ) === $ index ) ) { if ( $ includeExpired || ! $ pref -> getExpiresAt ( ) || ( $ pref -> getExpiresAt ( ) > new \ DateTime ( ) ) ) return $ pref ; return false ; } } return false ; }
Return the entity object of the named preference

@param string $name The named attribute / preference to check for
@param int $index default null If an indexed preference, get a specific index
@param boolean $includeExpired default false If true, include preferences even if they have expired.
@return WithPreference If the named preference is not defined, returns FALSE; otherwise it returns the Doctrine_Record
Return the entity object of the named preference