protected function _afterEntityInsert(AnCommandContext $context)
    {
        $entity = $context->entity;
        $id = $this->getDescription()->getIdentityProperty()->getName();

        //insert the entity into the space
        $this->getSpace()->insertEntity($entity, array($id => $context['result']));

        //set the identity proeprty value
        $entity->set($id, $context->result);

        $relationships = $this->getDescription()->getRelationships();
        //reset all the one to many and many to many relationships
        foreach ($relationships as $relation) {
            if ($relation->isOneToMany() && !$relation->isOneToOne()) {
                unset($entity->{$relation->getName()});
            }
        }

        $this->getSpace()->setEntityState($entity, AnDomain::STATE_INSERTED);

        //entity is now persisted
        $entity->setPersisted(true);
    }
protected function _afterEntityInsert(AnCommandContext $context)
    {
        $entity = $context->entity;
        $id = $this->getDescription()->getIdentityProperty()->getName();

        //insert the entity into the space
        $this->getSpace()->insertEntity($entity, array($id => $context['result']));

        //set the identity proeprty value
        $entity->set($id, $context->result);

        $relationships = $this->getDescription()->getRelationships();
        //reset all the one to many and many to many relationships
        foreach ($relationships as $relation) {
            if ($relation->isOneToMany() && !$relation->isOneToOne()) {
                unset($entity->{$relation->getName()});
            }
        }

        $this->getSpace()->setEntityState($entity, AnDomain::STATE_INSERTED);

        //entity is now persisted
        $entity->setPersisted(true);
    }
protected function _afterEntityInsert ( AnCommandContext $ context ) { $ entity = $ context -> entity ; $ id = $ this -> getDescription ( ) -> getIdentityProperty ( ) -> getName ( ) ; //insert the entity into the space $ this -> getSpace ( ) -> insertEntity ( $ entity , array ( $ id => $ context [ 'result' ] ) ) ; //set the identity proeprty value $ entity -> set ( $ id , $ context -> result ) ; $ relationships = $ this -> getDescription ( ) -> getRelationships ( ) ; //reset all the one to many and many to many relationships foreach ( $ relationships as $ relation ) { if ( $ relation -> isOneToMany ( ) && ! $ relation -> isOneToOne ( ) ) { unset ( $ entity -> { $ relation -> getName ( ) } ) ; } } $ this -> getSpace ( ) -> setEntityState ( $ entity , AnDomain :: STATE_INSERTED ) ; //entity is now persisted $ entity -> setPersisted ( true ) ; }
After an enttiy has been inserted into the repository.

@param AnCommandContext $context Context
After an enttiy has been inserted into the repository .