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); }
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]); }
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()); }
public function entity(OwnerDTO $dto, Owner $entity) { $entity->setEmail($dto->getEmail()); // $entity->setPassword($dto->getPassword()); }