Hi
I'v started working my way through the Silverstripe book but i'm getting an error which i cant seem to solve.
The error happens when this method is called (page 154 of the book), it appear that it does not like $this->Subscribers()
function MemberIsSubscribed($member = null)
{
if(!$member) $member = Member::CurrentMember();
$idList = $this->Subscribers()->getIdList();
return in_array($member->ID,$idList);
return false;
}
Heres the error returned
[Warning] reset() expects parameter 1 to be array, null given
GET /ssbook/jobs/programming
Line 101 in C:\wamp\www\ssbook\sapphire\core\ClassInfo.php
Source
92 * Return the root data class for that class.
93 * This root table has a lot of special use in the DataObject system.
94 *
95 * @param mixed $class string of the classname or instance of the class
96 * @return array
97 */
98 static function baseDataClass($class) {
99 global $_ALL_CLASSES;
100 if (is_object($class)) $class = get_class($class);
101 reset($_ALL_CLASSES['parents'][$class]);
102 while($val = next($_ALL_CLASSES['parents'][$class])) {
103 if($val == 'DataObject') break;
104 }
105 $baseDataClass = next($_ALL_CLASSES['parents'][$class]);
106 return $baseDataClass ? $baseDataClass : $class;
107 }
any ideas on what might be causing this?
Thanks
Phil