本文整理汇总了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();
}