当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthorPeer::doSelect方法代码示例

本文整理汇总了PHP中AuthorPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthorPeer::doSelect方法的具体用法?PHP AuthorPeer::doSelect怎么用?PHP AuthorPeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthorPeer的用法示例。


在下文中一共展示了AuthorPeer::doSelect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 /**
  * This is run after each unit test.  It empties the database.
  */
 protected function tearDown()
 {
     BookstoreDataPopulator::depopulate();
     $this->assertEquals(0, count(BookPeer::doSelect(new Criteria())), "Expect book table to be empty.");
     $this->assertEquals(0, count(AuthorPeer::doSelect(new Criteria())), "Expect author table to be empty.");
     $this->assertEquals(0, count(PublisherPeer::doSelect(new Criteria())), "Expect publisher table to be empty.");
     $this->assertEquals(0, count(ReviewPeer::doSelect(new Criteria())), "Expect review table to be empty.");
     $this->assertEquals(0, count(MediaPeer::doSelect(new Criteria())), "Expect media table to be empty.");
     $this->assertEquals(0, count(BookstoreEmployeePeer::doSelect(new Criteria())), "Expect bookstore_employee table to be empty.");
     $this->assertEquals(0, count(BookstoreEmployeeAccountPeer::doSelect(new Criteria())), "Expect bookstore_employee_account table to be empty.");
     $this->assertEquals(0, count(BookstoreSalePeer::doSelect(new Criteria())), "Expect bookstore_sale table to be empty.");
     BookPeer::clearInstancePool();
     $this->assertEquals(0, count(BookPeer::$instances), "Expected 0 Book instances after clearInstancePool()");
     AuthorPeer::clearInstancePool();
     $this->assertEquals(0, count(AuthorPeer::$instances), "Expected 0 Author instances after clearInstancePool()");
     PublisherPeer::clearInstancePool();
     $this->assertEquals(0, count(PublisherPeer::$instances), "Expected 0 Publisher instances after clearInstancePool()");
     ReviewPeer::clearInstancePool();
     $this->assertEquals(0, count(ReviewPeer::$instances), "Expected 0 Review instances after clearInstancePool()");
     MediaPeer::clearInstancePool();
     $this->assertEquals(0, count(MediaPeer::$instances), "Expected 0 Media instances after clearInstancePool()");
     BookstoreEmployeePeer::clearInstancePool();
     $this->assertEquals(0, count(BookstoreEmployeePeer::$instances), "Expected 0 BookstoreEmployee instances after clearInstancePool()");
     BookstoreEmployeeAccountPeer::clearInstancePool();
     $this->assertEquals(0, count(BookstoreEmployeeAccountPeer::$instances), "Expected 0 BookstoreEmployeeAccount instances after clearInstancePool()");
     BookstoreSalePeer::clearInstancePool();
     $this->assertEquals(0, count(BookstoreSalePeer::$instances), "Expected 0 BookstoreSale instances after clearInstancePool()");
     parent::tearDown();
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:32,代码来源:BookstoreTestBase.php

示例2: check_tables_empty

function check_tables_empty()
{
    try {
        print "\nChecking to see that tables are empty\n";
        print "-------------------------------------\n\n";
        print "Ensuring that there are no records in [author] table: ";
        $res = AuthorPeer::doSelect(new Criteria());
        print boolTest(empty($res));
        print "Ensuring that there are no records in [publisher] table: ";
        $res2 = PublisherPeer::doSelect(new Criteria());
        print boolTest(empty($res2));
        print "Ensuring that there are no records in [book] table: ";
        $res3 = AuthorPeer::doSelect(new Criteria());
        print boolTest(empty($res3));
        print "Ensuring that there are no records in [review] table: ";
        $res4 = ReviewPeer::doSelect(new Criteria());
        print boolTest(empty($res4));
        print "Ensuring that there are no records in [media] table: ";
        $res5 = MediaPeer::doSelect(new Criteria());
        print boolTest(empty($res5));
        print "Ensuring that there are no records in [book_club_list] table: ";
        $res6 = BookClubListPeer::doSelect(new Criteria());
        print boolTest(empty($res6));
        print "Ensuring that there are no records in [book_x_list] table: ";
        $res7 = BookListRelPeer::doSelect(new Criteria());
        print boolTest(empty($res7));
        return empty($res) && empty($res2) && empty($res3) && empty($res4) && empty($res5);
    } catch (Exception $e) {
        die("Error ensuring tables were empty: " . $e->__toString());
    }
}
开发者ID:yasirgit,项目名称:afids,代码行数:31,代码来源:bookstore-test.php

示例3: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     # Recently added
     $c = new Criteria();
     $c->addDescendingOrderByColumn(PluginPeer::CREATED_AT);
     $c->setLimit(6);
     $this->recent = PluginPeer::doSelect($c);
     # Most downloaded
     $c = new Criteria();
     $c->addDescendingOrderByColumn(PluginPeer::DOWNLOADS_COUNT);
     $c->setLimit(3);
     $this->hot = PluginPeer::doSelect($c);
     # Tags
     $c = new Criteria();
     $c->addDescendingOrderByColumn(TermPeer::COUNT);
     $c->setLimit(10);
     $this->terms = TermPeer::retrieveTags($c);
     # Authors
     $c = new Criteria();
     $c->addDescendingOrderByColumn(AuthorPeer::LOGGED_AT);
     $c->setLimit(6);
     // if ($this->getUser()->isAuthenticated())
     // 	$c->add(AuthorPeer::ID, $this->getUser()->getId(), Criteria::NOT_EQUAL);
     $this->authors = AuthorPeer::doSelect($c);
 }
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:30,代码来源:actions.class.php

示例4: emptyTables

 protected function emptyTables()
 {
     $res1 = AuthorPeer::doSelect(new Criteria());
     $res2 = PublisherPeer::doSelect(new Criteria());
     $res3 = AuthorPeer::doSelect(new Criteria());
     $res4 = ReviewPeer::doSelect(new Criteria());
     $res5 = MediaPeer::doSelect(new Criteria());
     $res6 = BookClubListPeer::doSelect(new Criteria());
     $res7 = BookListRelPeer::doSelect(new Criteria());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:10,代码来源:speed.php

示例5: testDoDelete_MultiTable

 /**
  * Test ability to delete multiple rows via single Criteria object.
  */
 public function testDoDelete_MultiTable()
 {
     $selc = new Criteria();
     $selc->add(BookPeer::TITLE, "Harry Potter and the Order of the Phoenix");
     $hp = BookPeer::doSelectOne($selc);
     // print "Attempting to delete [multi-table] by found pk: ";
     $c = new Criteria();
     $c->add(BookPeer::ID, $hp->getId());
     // The only way for multi-delete to work currently
     // is to specify the author_id and publisher_id (i.e. the fkeys
     // have to be in the criteria).
     $c->add(AuthorPeer::ID, $hp->getAuthorId());
     $c->add(PublisherPeer::ID, $hp->getPublisherId());
     $c->setSingleRecord(true);
     BookPeer::doDelete($c);
     //print_r(AuthorPeer::doSelect(new Criteria()));
     // check to make sure the right # of records was removed
     $this->assertEquals(3, count(AuthorPeer::doSelect(new Criteria())), "Expected 3 authors after deleting.");
     $this->assertEquals(3, count(PublisherPeer::doSelect(new Criteria())), "Expected 3 publishers after deleting.");
     $this->assertEquals(3, count(BookPeer::doSelect(new Criteria())), "Expected 3 books after deleting.");
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:24,代码来源:GeneratedPeerDoDeleteTest.php

示例6: testScenarioUsingQuery


//.........这里部分代码省略.........
     $rev1 = new Review();
     $rev1->setReviewDate("08/09/2001");
     // will fail: reviewed_by column required
     $bk1->addReview($rev1);
     $ret2 = $bk1->validate();
     $this->assertFalse($ret2, 'validation failed');
     $failures2 = $bk1->getValidationFailures();
     $this->assertEquals(3, count($failures2), '3 validation messages were returned');
     $expectedKeys = array(AuthorPeer::LAST_NAME, BookPeer::TITLE, ReviewPeer::REVIEWED_BY);
     $this->assertEquals($expectedKeys, array_keys($failures2), 'correct columns failed');
     $bk2 = new Book();
     $bk2->setTitle("12345678901");
     // passes
     $auth2 = new Author();
     $auth2->setLastName("Blah");
     //passes
     $auth2->setEmail("some@body.com");
     //passes
     $auth2->setAge(50);
     //passes
     $bk2->setAuthor($auth2);
     $rev2 = new Review();
     $rev2->setReviewedBy("Me!");
     // passes
     $rev2->setStatus("new");
     // passes
     $bk2->addReview($rev2);
     $ret3 = $bk2->validate();
     $this->assertTrue($ret3, 'complex validation can pass');
     // Testing doCount() functionality
     // -------------------------------
     // old way
     $c = new Criteria();
     $records = BookPeer::doSelect($c);
     $count = BookPeer::doCount($c);
     $this->assertEquals($count, count($records), 'correct number of results');
     // new way
     $count = BookQuery::create()->count();
     $this->assertEquals($count, count($records), 'correct number of results');
     // Test many-to-many relationships
     // ---------------
     // init book club list 1 with 2 books
     $blc1 = new BookClubList();
     $blc1->setGroupLeader("Crazyleggs");
     $blc1->setTheme("Happiness");
     $brel1 = new BookListRel();
     $brel1->setBook($phoenix);
     $brel2 = new BookListRel();
     $brel2->setBook($dj);
     $blc1->addBookListRel($brel1);
     $blc1->addBookListRel($brel2);
     $blc1->save();
     $this->assertNotNull($blc1->getId(), 'BookClubList 1 was saved');
     // init book club list 2 with 1 book
     $blc2 = new BookClubList();
     $blc2->setGroupLeader("John Foo");
     $blc2->setTheme("Default");
     $brel3 = new BookListRel();
     $brel3->setBook($phoenix);
     $blc2->addBookListRel($brel3);
     $blc2->save();
     $this->assertNotNull($blc2->getId(), 'BookClubList 2 was saved');
     // re-fetch books and lists from db to be sure that nothing is cached
     $crit = new Criteria();
     $crit->add(BookPeer::ID, $phoenix->getId());
     $phoenix = BookPeer::doSelectOne($crit);
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:67,代码来源:BookstoreTest.php

示例7: retrieveByPKs

 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(AuthorPeer::ID, $pks, Criteria::IN);
         $objs = AuthorPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:15,代码来源:BaseAuthorPeer.php

示例8: testAddJoinConditionWithNotInOperator

 public function testAddJoinConditionWithNotInOperator()
 {
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $c = new ModelCriteria('bookstore', 'Author');
     $c->join('Author.Book', Criteria::LEFT_JOIN);
     $c->addJoinCondition('Book', 'Book.isbn NOT IN ?', array(1, 7, 42));
     $c->limit(1);
     $books = AuthorPeer::doSelect($c, $con);
     $expectedSQL = "SELECT author.id, author.first_name, author.last_name, author.email, author.age FROM `author` LEFT JOIN `book` ON (author.id=book.author_id AND book.isbn NOT IN (1,7,42)) LIMIT 1";
     $this->assertEquals($expectedSQL, $con->getLastExecutedQuery(), 'addJoinCondition() allows the use of custom conditions');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:11,代码来源:ModelCriteriaTest.php


注:本文中的AuthorPeer::doSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。