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']()); } }
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; }
protected function create(Entity $entity) { $entity->id = md5(rand() . microtime() . rand()); $this->entities[$entity->id] = $entity->toArray(); }
public function __construct(Entity $entity) { $this->entity = $entity; $this->id = !$entity->isDetached() ? $entity->id : null; }
public function __invoke(DocTagInterface $tag, ReflectionProperty $property, Entity $entity) { $entity->setAutoloader($property->getName(), $tag->getValue()); }