Class Project is not extending a core class?

A

----- Original Message ----- From: "tdoc" <[email protected]>
To: "NZ PHP Users Group" <[email protected]>
Sent: Tuesday, October 12, 2010 1:42 PM
Subject: [phpug] [Silverstripe] has_many relationship view issue


Using Silverstripe CMS, I have a homepage that will have a listing of
featured 'projects':

class HomePage extends Page {
 ...
 static $has_many = array('Projects' => 'Project');
 ...
 function getCMSFields() {
 ...
   $projectsField = new HasManyComplexTableField( $this, 'Projects',
array('Title'=>'Project'), 'getCMSFields_forPopup');
   $fields->addFieldToTab('Root.Content.Projects');
 ...
 }
}

class Project {
 ...
static $has_one = array('HomePageListing' => 'HomePage');
 ...
}

So far, so good. I can edit the relationship in the CMS.

When I try to iterate over the elements in this has_many relationship,
though, I am unable. In my view if I place <% control Projects %>...<%
end_control %>, nothing happens. Similarly, if I place <% if Projects
%>...<% end_if %> somewhere, the block is never branched into.

Thanks for any help.

Cheers
tdoc

--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to