public function &modify(EntityInterface &$instance, array $attributes = null, $save = true)
    {
        if ($instance->isNew()) {
            throw new RuntimeException('Only objects that are saved to database can be modified');
        }

        $registered_type = $this->requireRegisteredType(get_class($instance));

        $instance = $this->getProducerForRegisteredType($registered_type)->modify($instance, $attributes, $save);

        if ($instance instanceof EntityInterface) {
            $this->objects_pool[$registered_type][$instance->getId()] = $instance;
        }

        return $instance;
    }
public function &modify(EntityInterface &$instance, array $attributes = null, $save = true)
    {
        if ($instance->isNew()) {
            throw new RuntimeException('Only objects that are saved to database can be modified');
        }

        $registered_type = $this->requireRegisteredType(get_class($instance));

        $instance = $this->getProducerForRegisteredType($registered_type)->modify($instance, $attributes, $save);

        if ($instance instanceof EntityInterface) {
            $this->objects_pool[$registered_type][$instance->getId()] = $instance;
        }

        return $instance;
    }
public function & modify ( EntityInterface & $ instance , array $ attributes = null , $ save = true ) { if ( $ instance -> isNew ( ) ) { throw new RuntimeException ( 'Only objects that are saved to database can be modified' ) ; } $ registered_type = $ this -> requireRegisteredType ( get_class ( $ instance ) ) ; $ instance = $ this -> getProducerForRegisteredType ( $ registered_type ) -> modify ( $ instance , $ attributes , $ save ) ; if ( $ instance instanceof EntityInterface ) { $ this -> objects_pool [ $ registered_type ] [ $ instance -> getId ( ) ] = $ instance ; } return $ instance ; }
Update an instance.

@param  EntityInterface $instance
@param  array|null      $attributes
@param  bool            $save
@return EntityInterface
Update an instance .