本文整理汇总了PHP中Doctrine\Common\Collections\Collection::current方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::current方法的具体用法?PHP Collection::current怎么用?PHP Collection::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\Collection
的用法示例。
在下文中一共展示了Collection::current方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCurrent
/**
* @dataProvider provideCollection
*/
public function testCurrent(Collection $coll, array $elements)
{
$this->assertSame(current($elements), $coll->current());
next($elements);
$coll->next();
$this->assertSame(current($elements), $coll->current());
}
示例2: generateCells
/**
* Generates the cells.
*
* @param TableView $view
*/
private function generateCells(TableView $view)
{
$sortDirs = [ColumnSort::ASC, ColumnSort::DESC];
$columns = $this->config->getColumns();
foreach ($columns as &$columnOptions) {
$key = $columnOptions['full_name'] . '_sort';
$sortDir = $this->requestHelper->getVar($key, ColumnSort::NONE);
$columnOptions['sorted'] = in_array($sortDir, $sortDirs);
}
unset($columnOptions);
$this->data->first();
while ($this->data->current()) {
$row = new Row($this->getCurrentRowData('id'));
// TODO getCurrentRowKey() ?
foreach ($columns as $columnOptions) {
$cell = new Cell();
$type = $this->factory->getColumnType($columnOptions['type']);
$type->buildViewCell($cell, $this, $columnOptions);
$row->cells[] = $cell;
}
$view->rows[] = $row;
$this->data->next();
}
}
示例3: current
/**
* Gets the element of the collection at the current iterator position.
*/
public function current()
{
return $this->coll->current();
}
示例4: current
/**
* {@inheritDoc}
*/
public function current()
{
$this->initialize();
return $this->collection->current();
}
示例5: getNextUnit
/**
* @param Collection $units
*
* @return OrderItemUnitInterface
*/
private function getNextUnit(Collection $units)
{
$unit = $units->current();
if (null === $unit) {
throw new \InvalidArgumentException('The number of tax items is greater than number of units.');
}
$units->next();
return $unit;
}
示例6: current
/**
* Gets the element of the collection at the current iterator position.
*
* @return mixed
*/
function current()
{
$this->initialize();
$current = $this->collection->current();
return $current->getTerm();
}
示例7: current
/**
* {@inheritdoc}
*/
public function current()
{
return $this->inner->current();
}
示例8: getChildren
public function getChildren()
{
return new RecursiveTaskIterator($this->_data->current()->getChildrenTask());
}