protected function _afterEntityInstantiate(AnCommandContext $context)
    {
        $entity = $context->entity;

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

        //set the entity default valuees
        $attributes = $this->getDescription()->getAttributes();
        foreach ($attributes as $attribute) {
            $entity->set($attribute->getName(), $attribute->getDefaultValue());
        }

        //materialize required one-to-one relationship
        $relationships = $this->getDescription()->getRelationships();
        foreach ($relationships as $relation) {
            if ($relation->isOneToOne() && $relation->isRequired()) {
                $property = $relation->getName();
                $$entity->set($property, $relation->getChildRepository()->getEntity());
            }
        }
    }