예제 #1
0
파일: Filter.php 프로젝트: devco/model
 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']());
     }
 }
예제 #2
0
파일: Mapper.php 프로젝트: devco/model
 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;
 }
예제 #3
0
 protected function create(Entity $entity)
 {
     $entity->id = md5(rand() . microtime() . rand());
     $this->entities[$entity->id] = $entity->toArray();
 }
예제 #4
0
 public function __construct(Entity $entity)
 {
     $this->entity = $entity;
     $this->id = !$entity->isDetached() ? $entity->id : null;
 }
예제 #5
0
파일: Autoload.php 프로젝트: devco/model
 public function __invoke(DocTagInterface $tag, ReflectionProperty $property, Entity $entity)
 {
     $entity->setAutoloader($property->getName(), $tag->getValue());
 }