public function actionAuhtor() { if ($this->session->isLoging()) { echo 'Вы уже авторизированны!'; exit; } $Author = new Author(); if ($Author->getOneAuthor($this->params['login'], $this->params['pass'])) { $this->session->set('loging', 'loging'); $this->session->set('author_id', $Author->getAuthorId()); $this->session->set('login', $Author->getLogin()); $this->session->set('pass', $Author->getPass()); $this->session->set('logo', $Author->getLogo()); $this->session->set('name', $Author->getName()); } $this->view = new View($this->params, PATH_VIEW_MESSAGE, 'welcom_tpl.php', false); $this->html->add('content', $this->view->render()); $layout = new Layout($this->html->getArray()); $layout->get(); }
public function testAnonymousSave() { $author = new Author(); $author->setName('Phillip K. Dick'); $book = new Book(); $book->setTitle('Minority Report'); $book2 = new Book(); $book2->setTitle('Do Androids Dream of Electric Sheep'); // $library = new Library(); // $library->setName('Travis County Reader'); $author->addBook($book); $author->addBook($book2); $this->assertEqual(count($author->getBook_Collection()), 2); // $book2library = new Book2library(); // $book2library->setLibrary_Object($library); // $book->addBook2library($book2library); // $book2->addBook2library($book2library); // $this->db->getDb()->startLoggingQueries(); $author->save(); // $this->dump($author->getBook_Collection()); // print_r($this->db->getDb()->getQueryLog()); $this->assertNotNull($author->getAuthorId()); $this->assertNotNull($book->getBookId()); $this->assertNotNull($book->getAuthorId()); $this->assertIdentical($book->getAuthorId(), $author->getAuthorId()); $this->assertNotNull($book2->getBookId()); $this->assertNotNull($book2->getAuthorId()); $this->assertIdentical($book2->getAuthorId(), $author->getAuthorId()); }