當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PropelObjectCollection::save方法代碼示例

本文整理匯總了PHP中PropelObjectCollection::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP PropelObjectCollection::save方法的具體用法?PHP PropelObjectCollection::save怎麽用?PHP PropelObjectCollection::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PropelObjectCollection的用法示例。


在下文中一共展示了PropelObjectCollection::save方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSaveOnReadOnlyEntityThrowsException

 /**
  * @expectedException PropelException
  */
 public function testSaveOnReadOnlyEntityThrowsException()
 {
     $col = new PropelObjectCollection();
     $col->setModel('ContestView');
     $cv = new ContestView();
     $col[] = $cv;
     $col->save();
 }
開發者ID:keneanung,項目名稱:gw2spidy,代碼行數:11,代碼來源:PropelObjectCollectionTest.php

示例2: createBooks

 protected function createBooks($nb = 15, $con = null)
 {
     BookQuery::create()->deleteAll($con);
     $books = new PropelObjectCollection();
     $books->setModel('Book');
     for ($i = 0; $i < $nb; $i++) {
         $b = new Book();
         $b->setTitle('Book' . $i);
         $books[] = $b;
     }
     $books->save($con);
 }
開發者ID:keneanung,項目名稱:gw2spidy,代碼行數:12,代碼來源:PropelModelPagerTest.php

示例3: testFromArray

 public function testFromArray()
 {
     $author = new Author();
     $author->setFirstName('Jane');
     $author->setLastName('Austen');
     $author->save();
     $books = array(array('Title' => 'Mansfield Park', 'AuthorId' => $author->getId()), array('Title' => 'Pride And PRejudice', 'AuthorId' => $author->getId()));
     $col = new PropelObjectCollection();
     $col->setModel('Book');
     $col->fromArray($books);
     $col->save();
     $nbBooks = PropelQuery::from('Book')->count();
     $this->assertEquals(6, $nbBooks);
     $booksByJane = PropelQuery::from('Book b')->join('b.Author a')->where('a.LastName = ?', 'Austen')->count();
     $this->assertEquals(2, $booksByJane);
 }
開發者ID:keneanung,項目名稱:gw2spidy,代碼行數:16,代碼來源:PropelObjectCollectionWithFixturesTest.php

示例4: populateCreatedAt

 protected function populateCreatedAt()
 {
     Table2Query::create()->deleteAll();
     $ts = new PropelObjectCollection();
     $ts->setModel('Table2');
     for ($i = 0; $i < 10; $i++) {
         $t = new Table2();
         $t->setTitle('CreatedAt' . $i);
         $t->setCreatedAt(time() - $i * 24 * 60 * 60 - 30);
         $ts[] = $t;
     }
     $ts->save();
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:13,代碼來源:TimestampableBehaviorTest.php


注:本文中的PropelObjectCollection::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。