*/
private $valueInstance = null;
+ /**
+ * Extra instance to the class which provides field values
+ */
+ private $extraInstance = null;
+
/**
* Rendered content created by the helper class
*/
public function assignFieldWithFilter ($fieldName, $filterMethod) {
// Get the value
$fieldValue = $this->getValueField($fieldName);
+ //* DEBUG: */ $this->debugOutput($fieldName.'='.$fieldValue);
// Now filter it through the value through the filter method
$filteredValue = call_user_func_array(array($this, 'doFilter' . $this->convertToClassName($filterMethod)), array($fieldValue));
* @throws NullPointerException If recovery of requested value instance failed
*/
public function prefetchValueInstance ($registryKey, $extraKey = null) {
+ //* DEBUG: */ $this->debugOutput('O:'.$registryKey.'/'.$extraKey);
try {
// Get the required instance
$this->valueInstance = Registry::getRegistry()->getInstance($registryKey);
} catch (NullPointerException $e) {
// Not set in registry
// @TODO Try to log it here
+ //* DEBUG: */ $this->debugOutput($registryKey.'=NULL!');
}
- // Is the value instance valid?
- if (is_null($this->valueInstance)) {
- // Try to create it "from scratch", by first init extra instance
- $extraInstance = null;
-
- // Shall we get an extra instance?
- if (!is_null($extraKey)) {
+ // Shall we get an extra instance?
+ if (!is_null($extraKey)) {
+ try {
// Get the extra instance.
- $extraInstance = Registry::getRegistry()->getInstance($extraKey);
- } // END - if
+ $this->extraInstance = Registry::getRegistry()->getInstance($extraKey);
+ } catch (NullPointerException $e) {
+ // Try to create it
+ $this->extraInstance = ObjectFactory::createObjectByConfiguredName($extraKey . '_class', array($this->valueInstance));
+ }
+ //* DEBUG: */ $this->debugOutput($extraKey.'='.$this->extraInstance.' - EXTRA!');
+ } // END - if
+ // Is the value instance valid?
+ if (is_null($this->valueInstance)) {
try {
// Get the requested instance
- $this->valueInstance = ObjectFactory::createObjectByConfiguredName($registryKey . '_class', array($extraInstance));
+ $this->valueInstance = ObjectFactory::createObjectByConfiguredName($registryKey . '_class', array($this->extraInstance));
} catch (FrameworkException $e) {
// Okay, nothing found so throw a null pointer exception here
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
// Get the field value
$fieldValue = $this->getValueInstance()->getField($fieldName);
+ //* DEBUG: */ $this->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).')');
+
+ // Is it null?
+ if ((is_null($fieldValue)) && (!is_null($this->extraInstance))) {
+ // So try the extra instance
+ $fieldValue = $this->extraInstance->getField($fieldName);
+ } // END - if
// Return it
return $fieldValue;
// Get result back
$resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
+ // Advance to first entry by default
+ $resultInstance->next();
+
// Set it in this instance
$pointsInstance->setResultInstance($resultInstance);
// Get the required points entry
$requiredPoints = $this->getConfigInstance()->getConfigEntry($action . '_action_points');
+ // Rewind always
+ $this->getResultInstance()->rewind();
+
// Do we have an entry?
if ($this->getResultInstance()->next()) {
// Get the entry
* @return void
*/
function bookPointsDirectly ($amount) {
+ // Rewind always
+ $this->getResultInstance()->rewind();
+
// Do we have an entry?
if ($this->getResultInstance()->next()) {
// Get the entry