Exemplo n.º 1
0
 public function __invoke(DocTagInterface $tag, ReflectionClass $class, Entity $entity)
 {
     $info = $this->parseFilterInformation($tag->getValue());
     if ($info['direction'] === 'to') {
         $entity->addExportFilter($info['name'], new $info['class']());
     } else {
         $entity->addImportFilter($info['name'], new $info['class']());
     }
 }
Exemplo n.º 2
0
 public function __invoke(DocTagInterface $tag, ReflectionClass $class, Entity $entity)
 {
     $parts = explode(' ', $tag->getValue());
     $name = array_shift($parts);
     $key = $class->getName() . $name;
     if (isset(self::$cache[$key])) {
         $entity->setMapper($name, self::$cache[$key]);
         return;
     }
     $mapArr = new MapperArray();
     foreach ($parts as $class) {
         if ($class = trim($class)) {
             $mapArr->add(new $class());
         }
     }
     $entity->setMapper($name, $mapArr);
     self::$cache[$key] = $mapArr;
 }
Exemplo n.º 3
0
 protected function create(Entity $entity)
 {
     $entity->id = md5(rand() . microtime() . rand());
     $this->entities[$entity->id] = $entity->toArray();
 }
Exemplo n.º 4
0
 public function __construct(Entity $entity)
 {
     $this->entity = $entity;
     $this->id = !$entity->isDetached() ? $entity->id : null;
 }
Exemplo n.º 5
0
 public function __invoke(DocTagInterface $tag, ReflectionProperty $property, Entity $entity)
 {
     $entity->setAutoloader($property->getName(), $tag->getValue());
 }