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


PHP AuthorPeer::doSelectOne方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     BookstoreDataPopulator::populate();
     $cr = new Criteria();
     $cr->add(AuthorPeer::LAST_NAME, "Rowling");
     $cr->add(AuthorPeer::FIRST_NAME, "J.K.");
     $rowling = AuthorPeer::doSelectOne($cr);
     $this->authorId = $rowling->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Philosopher's Stone");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Chamber of Secrets");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Prisoner of Azkaban");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Goblet of Fire");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Half-Blood Prince");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Deathly Hallows");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:46,代码来源:PropelPagerTest.php

示例2: testReloadDeep

 /**
  * Test reload(deep=true) method.
  */
 public function testReloadDeep()
 {
     BookstoreDataPopulator::populate();
     // arbitrary book
     $b = BookPeer::doSelectOne(new Criteria());
     // arbitrary, different author
     $c = new Criteria();
     $c->add(AuthorPeer::ID, $b->getAuthorId(), Criteria::NOT_EQUAL);
     $a = AuthorPeer::doSelectOne($c);
     $origAuthor = $b->getAuthor();
     $b->setAuthor($a);
     $this->assertNotEquals($origAuthor, $b->getAuthor(), "Expected just-set object to be different from obj from DB");
     $this->assertTrue($b->isModified());
     $b->reload($deep = true);
     $this->assertEquals($origAuthor, $b->getAuthor(), "Expected object in DB to be restored");
     $this->assertFalse($a->isModified());
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:20,代码来源:GeneratedObjectWithFixturesTest.php

示例3: testRefFKGetJoin

 public function testRefFKGetJoin()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     PublisherPeer::clearInstancePool();
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $author = AuthorPeer::doSelectOne(new Criteria(), $con);
     // populate book instance pool
     $books = $author->getBooksJoinPublisher(null, $con);
     $sql = $con->getLastExecutedQuery();
     $publisher = $books[0]->getPublisher($con);
     $this->assertEquals($sql, $con->getLastExecutedQuery(), 'refFK getter uses instance pool if possible');
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:14,代码来源:GeneratedObjectRelTest.php

示例4: testAddJoinMultipleWithNotInOperator

 public function testAddJoinMultipleWithNotInOperator()
 {
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $c = new Criteria();
     $c->addMultipleJoin(array(array(AuthorPeer::ID, BookPeer::AUTHOR_ID), array(BookPeer::ISBN, array(1, 7, 42), Criteria::NOT_IN)), Criteria::LEFT_JOIN);
     AuthorPeer::doSelectOne($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());
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:9,代码来源:CriteriaTest.php

示例5: getAuthor

 public function getAuthor(PropelPDO $con = null)
 {
     if ($this->aAuthor === null && $this->author_id !== null) {
         $c = new Criteria(AuthorPeer::DATABASE_NAME);
         $c->add(AuthorPeer::ID, $this->author_id);
         $this->aAuthor = AuthorPeer::doSelectOne($c, $con);
     }
     return $this->aAuthor;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:9,代码来源:BaseAuthorArticle.php


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