/**
  * @return Definition
  */
 public function createDefinition()
 {
     $definition = new Definition(new ClassName(Recipe::class), new Definition\Identity("name"), new IdentificationStrategy($this->storage));
     $definition->setObserved([new Definition\Property("steps"), new Definition\Property("publicationDate"), new Definition\Property("description")]);
     $definition->setEditCommandHandler(new EditCommandHandler($this->storage, $this->searchEngine));
     $definition->setNewCommandHandler(new NewCommandHandler($this->storage, $this->searchEngine));
     $definition->setRemoveCommandHandler(new RemoveCommandHandler($this->storage, $this->searchEngine));
     return $definition;
 }
    public static function buildDefinition()
    {
        $definition = new Definition(
            new ClassName(EntityFake::getClassName()),
            new Definition\Identity("id")
        );

        $definition->setObserved([
            new Definition\Property("firstName"),
            new Definition\Property("lastName")
        ]);

        return $definition;
    }
 /**
  * @return Definition
  */
 private function createAssociatedEntityDefinition()
 {
     $definition = new Definition(new ClassName(AssociatedEntityFake::getClassName()), new Definition\Identity("id"));
     $parentAssociation = new Definition\Association(new ClassName(AssociatedEntityFake::getClassName()), Definition\Association::TO_SINGLE_ENTITY);
     $definition->setObserved([new Definition\Property("parent", $parentAssociation), new Definition\Property("children", $this->createChildrenAssociation()), new Definition\Property("name")]);
     return $definition;
 }
Example #4
0
 /**
  * @return \Isolate\UnitOfWork\Entity\Definition
  */
 private function createFakeEntityDefinition()
 {
     $definition = new Definition(new ClassName(EntityFake::getClassName()), new Identity("id"));
     $definition->setObserved([new Property("firstName"), new Property("lastName"), new Property("items")]);
     $definition->setNewCommandHandler($this->newCommandHandler);
     $definition->setEditCommandHandler($this->editCommandHandler);
     $definition->setRemoveCommandHandler($this->removeCommandHandler);
     return $definition;
 }