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


PHP BookPeer::doSelectJoinAuthor方法代码示例

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


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

示例1: runJoinSearch

 function runJoinSearch($i)
 {
     $c = new Criteria();
     $c->add(BookPeer::TITLE, 'Hello' . $i, Criteria::EQUAL);
     $c->setLimit(1);
     $books = BookPeer::doSelectJoinAuthor($c, $this->con);
     $book = $books[0];
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:8,代码来源:Propel14TestSuite.php

示例2: testObjectInstances

 public function testObjectInstances()
 {
     $sample = BookPeer::doSelectOne(new Criteria());
     $samplePk = $sample->getPrimaryKey();
     // 1) make sure consecutive calls to retrieveByPK() return the same object.
     $b1 = BookPeer::retrieveByPK($samplePk);
     $b2 = BookPeer::retrieveByPK($samplePk);
     $sampleval = md5(microtime());
     $this->assertTrue($b1 === $b2, "Expected object instances to match for calls with same retrieveByPK() method signature.");
     // 2) make sure that calls to doSelect also return references to the same objects.
     $allbooks = BookPeer::doSelect(new Criteria());
     foreach ($allbooks as $testb) {
         if ($testb->getPrimaryKey() == $b1->getPrimaryKey()) {
             $this->assertTrue($testb === $b1, "Expected same object instance from doSelect() as from retrieveByPK()");
         }
     }
     // 3) test fetching related objects
     $book = BookPeer::retrieveByPK($samplePk);
     $bookauthor = $book->getAuthor();
     $author = AuthorPeer::retrieveByPK($bookauthor->getId());
     $this->assertTrue($bookauthor === $author, "Expected same object instance when calling fk object accessor as retrieveByPK()");
     // 4) test a doSelectJoin()
     $morebooks = BookPeer::doSelectJoinAuthor(new Criteria());
     for ($i = 0, $j = 0; $j < count($morebooks); $i++, $j++) {
         $testb1 = $allbooks[$i];
         $testb2 = $allbooks[$j];
         $this->assertTrue($testb1 === $testb2, "Expected the same objects from consecutive doSelect() calls.");
         // we could probably also test this by just verifying that $book & $testb are the same
         if ($testb1->getPrimaryKey() === $book) {
             $this->assertTrue($book->getAuthor() === $testb1->getAuthor(), "Expected same author object in calls to pkey-matching books.");
         }
     }
     // 5) test creating a new object, saving it, and then retrieving that object (should all be same instance)
     $b = new BookstoreEmployee();
     $b->setName("Testing");
     $b->setJobTitle("Testing");
     $b->save();
     $empId = $b->getId();
     $this->assertSame($b, BookstoreEmployeePeer::retrieveByPK($empId), "Expected newly saved object to be same instance as pooled.");
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:40,代码来源:GeneratedPeerDoSelectTest.php

示例3: testToArrayIncludeForeignObjects

 public function testToArrayIncludeForeignObjects()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     PublisherPeer::clearInstancePool();
     $c = new Criteria();
     $c->add(BookPeer::TITLE, 'Don Juan');
     $books = BookPeer::doSelectJoinAuthor($c);
     $book = $books[0];
     $arr1 = $book->toArray(BasePeer::TYPE_PHPNAME, null, true);
     $expectedKeys = array('Id', 'Title', 'ISBN', 'Price', 'PublisherId', 'AuthorId', 'Author');
     $this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() can return sub arrays for hydrated related objects');
     $this->assertEquals('George', $arr1['Author']['FirstName'], 'toArray() can return sub arrays for hydrated related objects');
     $c = new Criteria();
     $c->add(BookPeer::TITLE, 'Don Juan');
     $books = BookPeer::doSelectJoinAll($c);
     $book = $books[0];
     $arr2 = $book->toArray(BasePeer::TYPE_PHPNAME, null, true);
     $expectedKeys = array('Id', 'Title', 'ISBN', 'Price', 'PublisherId', 'AuthorId', 'Publisher', 'Author');
     $this->assertEquals($expectedKeys, array_keys($arr2), 'toArray() can return sub arrays for hydrated related objects');
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:22,代码来源:GeneratedObjectTest.php

示例4: testModifiedObjectsRemainInTheCollection

 public function testModifiedObjectsRemainInTheCollection()
 {
     $c = new Criteria();
     $c->add(BookPeer::ID, $this->books[0]->getId());
     $books = BookPeer::doSelectJoinAuthor($c);
     $books[0]->setTitle('Modified');
     $books2 = $books[0]->getAuthor()->getBooks();
     $this->assertEquals(2, count($books2));
     $this->assertEquals(2, $books2[0]->getAuthor()->countBooks());
     $this->assertEquals('Modified', $books2[0]->getTitle());
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:11,代码来源:PoisonedCacheBugTest.php


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