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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager Code Examples


Go to End


84 Posts   40578 Views

Avatar
vivilanco

Community Member, 19 Posts

3 February 2010 at 8:56am

sorry if i sound stupid, but what do you mean by that?

(as an FYI i have done a new install, only modules being: SWF upload and DataObjectManager)
I have onlu uploaded 1 file and ticked " This resource is viewable by the public "

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 February 2010 at 9:10am

You'll need to decorate the Group object by adding it in your _config.php

DataObject::add_extension("Group","MyGroupDecorator");

Where "MyGroupDecorator" is the name of the class you're using to extend the Group.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 February 2010 at 9:13am

Here's an example of a decorator for the Group:

MyGroup.php

class MyGroup extends DataObjectDecorator
{
	function extraStatics()
	{
		return array(
			'belongs_many_many' => array(
				'Resources' => 'Resource',
				'ResourcePage' => 'ResourcePage'
			)
		);
	}
}

Avatar
vivilanco

Community Member, 19 Posts

3 February 2010 at 9:38am

Thanks for the help, but i think i am stepping a little out of my depth.
I'm ok to play with the php but i'm struggling, its on my books to learn it but as of now i consider myself a designer with html, css and coffee :D

i really should put my mind to learning to write the stuff (php, javascript and ajax off my head and not just break it).

I will have a fresh look tomorrow. thanks UncleCheese. :D

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 February 2010 at 10:07am

Yeah, decorators are a little tricky. Do you need the the feature of associating resources with a Group, or did you just want the hierarchy that is used in that example?

Avatar
vivilanco

Community Member, 19 Posts

3 February 2010 at 10:10am

Group would be advantageous I won’t lie, and the potential client would find it useful, Im basically doing all this speculativly...

Ability for some files available via public connection, and registered members ability to access others.

Avatar
novaweb

Community Member, 116 Posts

5 March 2010 at 11:23am

Hey,

Are there any code examples for using DataObjectManager in a Page controller? ie front end in blackcandy?

Cheers,
Josh

Avatar
DanStephenson

Community Member, 116 Posts

17 March 2010 at 8:35pm

Josh,

The firs time I did that, I used the Testimonials tutorial in the DOM documentation in the Wiki, and applied it into my page template. It worked for me, and taught me what I was doing.