Exemplo n.º 1
0
 /**
  * @param array $data
  * @return Member
  */
 public function entity(array $data = [])
 {
     $member = new Member();
     $member->role = $data['role'];
     unset($data['role']);
     // @todo ここでFactoryオブジェクトを生成するのをなんとかしたい...
     $userFactory = new UserFactory();
     $member->account = $userFactory->entity($data);
     return $member;
 }
Exemplo n.º 2
0
 /**
  * @param array $data
  * @return File
  */
 public function entity(array $data = [])
 {
     $userFactory = new UserFactory();
     $file = new File();
     $file->account = $userFactory->entity($data['account']);
     unset($data['account']);
     foreach ($data as $key => $value) {
         $property = Inflector::variable($key);
         $file->{$property} = $value;
     }
     return $file;
 }
Exemplo n.º 3
0
 /**
  * @param array $data
  * @return Message
  */
 public function entity(array $data = [])
 {
     // @todo ここでnewするのなんとかしたい・・・
     $userFactory = new UserFactory();
     $message = new Message();
     $message->account = $userFactory->entity($data['account']);
     unset($data['account']);
     foreach ($data as $key => $value) {
         $property = Inflector::variable($key);
         $message->{$property} = $value;
     }
     return $message;
 }
Exemplo n.º 4
0
 /**
  * @param array $data
  * @return Task
  */
 public function entity(array $data = [])
 {
     // @todo あとでroomオブジェクトの生成方法とかを見直す
     $roomFactory = new RoomFactory();
     $userFactory = new UserFactory();
     $task = new Task();
     foreach ($data as $key => $value) {
         $property = Inflector::variable($key);
         if ($property == 'room') {
             $task->{$property} = $roomFactory->entity($value);
         } else {
             if ($property == 'assignedByAccount' || $property == 'account') {
                 $task->{$property} = $userFactory->entity($value);
             } else {
                 $task->{$property} = $value;
             }
         }
     }
     return $task;
 }