Пример #1
0
 /**
  * Creates an Link object based on a DB row.
  *
  * @param array $row The DB row containing Link data.
  * @return \WebLinks\Domain\Link
  */
 protected function buildDomainObject($row)
 {
     $link = new Link();
     $link->setId($row['link_id']);
     $link->setTitle($row['link_title']);
     $link->setUrl($row['link_url']);
     if (array_key_exists('user_id', $row)) {
         // Find and set the associated user
         $userId = $row['user_id'];
         $user = $this->userDAO->find($userId);
         $link->setAuthor($user);
     }
     return $link;
 }