Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Working through the book, Subscribers() problem

Go to End

2 Posts   1462 Views


Community Member, 81 Posts

5 August 2010 at 4:45am


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


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?



Community Member, 81 Posts

5 August 2010 at 4:54am

Sorry guys, I've solved the problem it was because i have written

static $many_many = array(
'Subscribers' => 'Members'

instead of

static $many_many = array(
'Subscribers' => 'Member'