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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Allow Comments in DataObjectManager


Reply

13 Posts   2020 Views

Avatar
UncleCheese

8 September 2010 at 1:33pm 4085 Posts

You added a $has_many inside the DataObjectManager class? It's a form field, not a model.

---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

Avatar
freenet

9 September 2010 at 12:30am (Last edited: 9 September 2010 12:42am), Community Member, 22 Posts

hmm... I added only a model in my class, then I do not understand what and where to add more.

I have a class BookPage extends Page and Book extends DataObject

In class Book I added:
static $has_many = array (
'LinkComment' => 'DataObjectComment'
)

in class BookPage_Controller added function:
function DataObjectComment () (
$Obj = DataObject::get_one ("Book", 'ID ='. Convert::raw2sql ((int) $this->urlParams['ID']));
return new DataObjectCommentInterface ($obj, 'DataObjectComments', $obj-> data ());
)

in Template i use $DataObjectComment and see Comments and form post, but he not work

Avatar
freenet

10 September 2010 at 1:16am Community Member, 22 Posts

I really do not know how to get to work. Maybe someone can give me an example for the study?

Avatar
freenet

23 September 2010 at 12:17am Community Member, 22 Posts

no anyone easy example?

Avatar
jmax

1 February 2012 at 10:56am Community Member, 17 Posts

Hi freenet,

have you solved your issue? If yes, can you help me with the same problem?

my issue is explained here..

http://www.silverstripe.org/dataobjectmanager-module-forum/show/19101

thanks