Beispiel #1
0
 public function view()
 {
     $owners = [];
     foreach (Owner::find() as $id => $owner) {
         if (count($owner['pets']) > 0) {
             $owners[$id] = $owner;
             $owners[$id]['active'] = Str::ends_with($_SERVER['REQUEST_URI'], 'pets/' . $owner['_id']);
         }
     }
     $this->set('owners', $owners);
 }
Beispiel #2
0
 public function action_index($username)
 {
     $owner = Owner::findOne($username);
     if (!$owner) {
         throw new HttpNotFoundException();
     }
     $this->title = $owner['_id'];
     $this->page_title = $owner['_id'];
     if ($owner['vacation']) {
         $this->page_title .= ' <span class="glyphicon glyphicon-plane"></span>';
     }
     $this->template->content = View::forge('pets/index', ['owner' => $owner]);
 }
Beispiel #3
0
 public function testCRUD()
 {
     $entity = new Owner();
     $entity->setEmail(self::EMAIL);
     $entity->setPassword(self::PASSWORD);
     $this->dao->persist($entity);
     $this->assertEquals(self::ID, $entity->getId());
     $this->assertEquals(self::EMAIL, $entity->getEmail());
     $this->assertEquals(self::PASSWORD, $entity->getPassword());
     $entity = $this->dao->findById(self::ID);
     $this->assertEquals(self::ID, $entity->getId());
     $this->assertEquals(self::EMAIL, $entity->getEmail());
     $this->assertEquals(self::PASSWORD, $entity->getPassword());
     $entity->setPassword(self::PASSWORD_ANOTHER);
     $this->dao->persist($entity);
     $entity = $this->dao->findById(self::ID);
     $this->assertEquals(self::ID, $entity->getId());
     $this->assertEquals(self::EMAIL, $entity->getEmail());
     $this->assertEquals(self::PASSWORD_ANOTHER, $entity->getPassword());
     $this->dao->remove($entity);
     $this->assertNull($entity->getId());
     $this->assertNull($entity->getEmail());
     $this->assertNull($entity->getPassword());
 }
Beispiel #4
0
 public function entity(OwnerDTO $dto, Owner $entity)
 {
     $entity->setEmail($dto->getEmail());
     //		$entity->setPassword($dto->getPassword());
 }