コード例 #1
0
 /**
  * @param PersonId $id
  * @return Person|null
  */
 public function find(PersonId $id)
 {
     $result = $this->query('SELECT * FROM people WHERE id = :id', ['id' => $id->toString()]);
     if (!$result) {
         return null;
     }
     $data = $result[0];
     $data['data'] = $this->query('SELECT * FROM people_data WHERE person_id = :id', ['id' => $id->toString()]);
     $data['tags'] = $this->query('SELECT * FROM tags WHERE person_id = :id', ['id' => $id->toString()]);
     return Person::fromDB($data);
 }
コード例 #2
0
ファイル: Person.php プロジェクト: novuso/common-l
 public static function register($name)
 {
     $id = PersonId::generate();
     $person = new self($id, $name);
     $person->recordThat(new PersonRegistered($id, $name));
     return $person;
 }
コード例 #3
0
ファイル: Person.php プロジェクト: WeCamp/Project-Cypher
 /**
  * @inheritdoc
  */
 public function jsonSerialize()
 {
     // YES! This is horrible, sorry, just needed a very quick fix!
     $canonical = $this->canonical;
     $filename = sprintf('%s/front/images/people/%s.jpg', public_path(), $canonical);
     if (!file_exists($filename)) {
         $canonical = 'blank';
     }
     return ['id' => $this->id->toString(), 'name' => $this->name, 'canonical' => $canonical, 'data' => $this->data, 'tags' => $this->tags];
 }