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   2028 Views

Avatar
UncleCheese

4085 Posts

8 September 2010 at 1:33pm

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

Community Member, 22 Posts

9 September 2010 at 12:30am

Edited: 09/09/2010 12:42am

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

Community Member, 22 Posts

10 September 2010 at 1:16am

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

Avatar
freenet

Community Member, 22 Posts

23 September 2010 at 12:17am

no anyone easy example?

Avatar
jmax

Community Member, 17 Posts

1 February 2012 at 10:56am

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