本文整理汇总了PHP中Collection::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::getId方法的具体用法?PHP Collection::getId怎么用?PHP Collection::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Collection
function test_find()
{
//Arrange
$name = "Hello Kitty";
$name2 = "Pokemon";
$test_collection = new Collection($name);
$test_collection->save();
$test_collection2 = new Collection($name2);
$test_collection2->save();
//Act
$result = Collection::find($test_collection2->getId());
//Assert
$this->assertEquals($test_collection2, $result);
}
示例2: Collection
function test_find()
{
//Arrange
$thing = "Run the World";
$thing2 = "20 20 Experience";
$test_collection = new Collection($thing);
$test_collection->save();
$test_collection2 = new Collection($thing2);
$test_collection2->save();
//Act
$id = $test_collection->getId();
$result = Collection::find($id);
//Assert
$this->assertEquals($test_collection, $result);
}
示例3: setCollection
/**
* Declares an association between this object and a Collection object.
*
* @param Collection $v
* @return CollectionFile The current object (for fluent API support)
* @throws PropelException
*/
public function setCollection(Collection $v = null)
{
if ($v === null) {
$this->setCollectionId(NULL);
} else {
$this->setCollectionId($v->getId());
}
$this->aCollection = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Collection object, it will not be re-added.
if ($v !== null) {
$v->addCollectionFile($this);
}
return $this;
}
示例4: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Collection $value A Collection object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Collection $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例5: testFind
function testFind()
{
//Arrange
$collection_name = "Rad stuff";
$test_collection = new Collection($collection_name);
$test_collection->save();
$test_collection_id = $test_collection->getId();
$name = "Hello Kitty";
$name2 = "Pokemon";
$test_item = new Item($name, $test_collection_id);
$test_item->save();
$test_item2 = new Item($name2, $test_collection_id);
$test_item2->save();
//Act
$result = Item::find($test_item2->getId());
//Assert
$this->assertEquals($test_item2, $result);
}