本文整理匯總了PHP中PropelObjectCollection::setData方法的典型用法代碼示例。如果您正苦於以下問題:PHP PropelObjectCollection::setData方法的具體用法?PHP PropelObjectCollection::setData怎麽用?PHP PropelObjectCollection::setData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PropelObjectCollection
的用法示例。
在下文中一共展示了PropelObjectCollection::setData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testTransformWithData
public function testTransformWithData()
{
$coll = new \PropelObjectCollection();
$coll->setData(array('foo', 'bar'));
$result = $this->transformer->transform($coll);
$this->assertTrue(is_array($result));
$this->assertCount(2, $result);
$this->assertEquals('foo', $result[0]);
$this->assertEquals('bar', $result[1]);
}
示例2: testSerializePropelObjectCollection
public function testSerializePropelObjectCollection()
{
$collection = new \PropelObjectCollection();
$collection->setData(array(new TestSubject('lolo'), new TestSubject('pepe')));
$json = $this->serializer->serialize($collection, 'json');
$data = json_decode($json, true);
$this->assertCount(2, $data);
//will fail if PropelCollectionHandler not loaded
foreach ($data as $testSubject) {
$this->assertArrayHasKey('name', $testSubject);
}
}
示例3: buildCollection
protected function buildCollection($arr)
{
$coll = new PropelObjectCollection();
$coll->setData($arr);
$coll->setModel('Table10');
return $coll;
}
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:7,代碼來源:NestedSetBehaviorQueryBuilderModifierWithScopeTest.php