src/Oss2/Doctrine2/WithPreferences.php
public function deletePreference( $name, $index = null )
    {
        $count = 0;

        foreach( $this->getPreferences() as $pref )
        {
            if( ( $pref->getName() == $name ) && ( ( $index === null ) || ( $pref->getIx() == $index ) ) )
            {
                $count++;
                $this->getPreferences()->removeElement( $pref );
                \D2EM::remove( $pref );
            }
        }

        return $count;
    }
public function deletePreference( $name, $index = null )
    {
        $count = 0;

        foreach( $this->getPreferences() as $pref )
        {
            if( ( $pref->getName() == $name ) && ( ( $index === null ) || ( $pref->getIx() == $index ) ) )
            {
                $count++;
                $this->getPreferences()->removeElement( $pref );
                \D2EM::remove( $pref );
            }
        }

        return $count;
    }
public function deletePreference ( $ name , $ index = null ) { $ count = 0 ; foreach ( $ this -> getPreferences ( ) as $ pref ) { if ( ( $ pref -> getName ( ) == $ name ) && ( ( $ index === null ) || ( $ pref -> getIx ( ) == $ index ) ) ) { $ count ++ ; $ this -> getPreferences ( ) -> removeElement ( $ pref ) ; \ D2EM :: remove ( $ pref ) ; } } return $ count ; }
Delete the named preference

WARNING: You need to EntityManager::flush() if the return > 0!

@param string $name The named attribute / preference to check for
@param int $index default null If an indexed preference then delete a specific index, if null then delete all
@return int The number of preferences deleted
Delete the named preference