[TYPO3-mvc] getX returns a boolean, isX returns null
Stephen Bungert
stephen at bungert.co.uk
Sat Jul 17 21:35:20 CEST 2010
I have the following method in one of my models:
/**
* Returns classes for the item to aid css styling (based on the values
of certain properties)
*
* @return string Classes for the item
*/
public function getClasses() {
$classes = '';
if ($this->getSoldout()) {
$classes .= ' soldout';
// using the "get" methods, returns a boolean value
echo "soldout " . gettype($this->getSoldout());
} else {
echo "not soldout " . gettype($this->getSoldout());
}
if ($this->isPremier()) {
$classes .= ' premier';
// using the "is" methods, returns null even if a get method would
return true
echo "premier " . gettype($this->isPremier());
} else {
echo "not premier " . gettype($this->isPremier());
}
if ($this->isCancelled() == true) {
$classes .= ' cancelled';
}
return $classes;
}
I find that using '$this->getSoldout()' returns true or false (premier,
soldout and cancelled are all boolean values), whereas
'$this->isSoldout()' retuns null whatever the actual property is set to.
isSoldout() is defined for me by the kickstarter, am I supposed to test
in the function what the return value is instead of just returning what
is getSoldout() returns? isSoldout just calls getSoldout, so why does it
return null?
More information about the TYPO3-project-typo3v4mvc
mailing list