/** * The functions that fixes and returns a value. * * Be warned: this function may return a lazy value. * * @param \MUtil_Lazy_StackInterface $stack A \MUtil_Lazy_StackInterface object providing variable data * @return mixed */ public function __toValue(\MUtil_Lazy_StackInterface $stack) { if (!$this->repeater) { $this->repeater = $this->bridge->getRepeater(); } $out = null; $current = $this->repeater->__current(); if ($current) { if (isset($current->{$this->fieldName})) { $out = $current->{$this->fieldName}; } } return $this->bridge->format($this->fieldName, $out); }
/** * Get the repeater source for the lazy data * * @return \MUtil_Lazy_RepeatableInterface */ public function getRepeater() { if (!$this->_repeater) { if ($this->_chainedBridge && $this->_chainedBridge->hasRepeater()) { $this->setRepeater($this->_chainedBridge->getRepeater()); } else { $this->setRepeater($this->model->loadRepeatable()); } } return $this->_repeater; }
/** * Get the repeater source for the lazy data * * @return \MUtil_Lazy_RepeatableInterface */ public function getRepeater() { if ($this->_repeater) { return $this->_repeater; } $repeater = $this->table->getRepeater(); if ($repeater) { $this->setRepeater($repeater); return $repeater; } $repeater = parent::getRepeater(); return $repeater; }