class CerEndPointIterator in Corresponding Entity References 7.3
@class The purpose of this iterator is to wrap around all the "endpoints" in a field chain. An endpoint is a CerFieldHandler for a field that hasn't got a child. This is necessary in order to support infinite levels of embedded entities (read: field collections). This class is only instantiated by CerFieldChainHandler if its initial field handler has a child (
Hierarchy
- class \CerEndPointIterator implements \RecursiveIterator
Expanded class hierarchy of CerEndPointIterator
See also
CerFieldHandler::__construct()).
File
- includes/
CerEndPointIterator.inc, line 16 - Contains CerEndPointIterator.
View source
class CerEndPointIterator implements RecursiveIterator {
/**
* @var CerField
*/
protected $field;
/**
* @var CerFieldHandler
*/
protected $handler;
public function __construct(CerField $field, EntityDrupalWrapper $entity) {
$this->field = $field;
$this->handler = $field
->getHandler($entity);
}
/**
* Implements Iterator::current().
*/
public function current() {
return $this->field
->child()
->getHandler($this->handler
->current());
}
/**
* Implements Iterator::key().
*/
public function key() {
return $this->handler
->key();
}
/**
* Implements Iterator::next().
*/
public function next() {
$this->handler
->next();
}
/**
* Implements Iterator::rewind().
*/
public function rewind() {
$this->handler
->rewind();
}
/**
* Implements Iterator::handler().
*/
public function valid() {
return $this->handler
->valid();
}
/**
* Implements RecursiveIterator::hasChildren().
*/
public function hasChildren() {
return $this->field
->child() instanceof CerEntityContainerInterface;
}
/**
* Implements RecursiveIterator::getChildren().
*/
public function getChildren() {
return new CerEndPointIterator($this->field
->child(), $this->handler
->current());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CerEndPointIterator:: |
protected | property | ||
CerEndPointIterator:: |
protected | property | ||
CerEndPointIterator:: |
public | function | Implements Iterator::current(). | |
CerEndPointIterator:: |
public | function | Implements RecursiveIterator::getChildren(). | |
CerEndPointIterator:: |
public | function | Implements RecursiveIterator::hasChildren(). | |
CerEndPointIterator:: |
public | function | Implements Iterator::key(). | |
CerEndPointIterator:: |
public | function | Implements Iterator::next(). | |
CerEndPointIterator:: |
public | function | Implements Iterator::rewind(). | |
CerEndPointIterator:: |
public | function | Implements Iterator::handler(). | |
CerEndPointIterator:: |
public | function |