本文整理匯總了PHP中Doctrine\Common\Collections\ArrayCollection::key方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayCollection::key方法的具體用法?PHP ArrayCollection::key怎麽用?PHP ArrayCollection::key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\Common\Collections\ArrayCollection
的用法示例。
在下文中一共展示了ArrayCollection::key方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: key
public function key()
{
if (null === $this->entries) {
$this->__load___();
}
return $this->entries->key();
}
示例2: testKey
/**
* Tests IdentityWrapper->key()
*/
public function testKey()
{
$this->assertSame(key($this->entries), $this->identityWrapper->key());
$this->identityWrapper->clear();
$this->assertNull($this->identityWrapper->key());
$this->assertNull($this->wrappedCollection->key());
}
示例3: testNext
/**
* @dataProvider provideDifferentElements
*/
public function testNext($elements)
{
$collection = new ArrayCollection($elements);
while (true) {
$collectionNext = $collection->next();
$arrayNext = next($elements);
if (!$collectionNext || !$arrayNext) {
break;
}
$this->assertSame($arrayNext, $collectionNext, "Returned value of ArrayCollection::next() and next() not match");
$this->assertSame(key($elements), $collection->key(), "Keys not match");
$this->assertSame(current($elements), $collection->current(), "Current values not match");
}
}
示例4: key
/** {@inheritDoc} */
public function key()
{
$this->initialize();
return $this->collection->key();
}
示例5: key
/**
* Gets the key/index of the element at the current iterator position.
*
* @return int|string
*/
public function key()
{
return $this->collection->key();
}
示例6: key
function key()
{
return $this->fields->key();
}