7955 Posts in 1394 Topics by 945 members
|Go to End||Next >|
12 April 2009 at 11:24am
UncleCheese the issue is not with the Page class itself. Make a subclass of Page (say Page2). No need to add any db field or relationship for that class. Now when you try to add a Resource object to a Page2 class page, the resource will not stick to that page. PageID is set to 0. The issue is always related to a subclass of Page.
Drye we have always had the related dataobjects sortable and it makes no difference.
12 April 2009 at 11:26am Last edited: 12 April 2009 11:27am
Its where you have a page two levels down from the root in the menu structure:
Brands :: Works fine
Brands -> Gucci :: Works Fine
Brands -> Gucci -> Watch :: Stops working here
So if you look at the attachment its at the Watch level where commenting out that line fixes the issue
12 April 2009 at 11:57am
Well I don't have any pages 3 levels deep using the DataObjectManager. But all of my 1 and 2 level Page subclasses seem to work. They each have there own data and do not display the data of other pages.
UncleCheese good luck with this one, I'm afraid I can offer no more.
13 April 2009 at 3:33pm
Hey, guys, I've fixed this bug. For those of you who hacked the code, please revert your changes and check out the new version to avoid conflicts in the future.
The problem was that FileDataObjectManager was erroneously using the controller to create the $ownerID field. It introspectively searches the has_many array of the controller class to find the relation name. Most of the time, the controller is passed as $this, which creates a problem. Take this example:
class Page extends SiteTree
static $has_many = array ('FileObjects' => 'FileObject');
class FileObject extends DataObject
static $has_one = array ('Page' => 'Page');
class SubPage extends Page
In the SubPage class, the controller $this will return a SubPage object. The has_many array search will return null in this case, so no $ownerID field is ever set.
The fix was to use the member method ComplexTableField::getParentIDName() to generate this fieldname correctly. It's still necessary to use the setParentClass method in this case, however. It's used in ComplextTableField for exactly this scenario, but it wasn't being taken advantage of since getParentIDName() wasn't being used.
13 April 2009 at 4:29pm
A little off topic..
Do you have a downloadable example of http://doc.silverstripe.com/doku.php?id=modules:swfuploadfield so I can look at the code. Having a number of issues trying to get this to work - I think if i can see how the working version is setup this will shed some light on where Ive gone wrong.
I saw this (http://www.silverstripe.org/archive/show/229938#post229938) but it still does not answer my questions. I'm a bit of a noob so its probably simple stuff. Would just like to see how its setup in the php file / front end.
13 April 2009 at 4:56pm
When adding file objects, how do you remove the "Upload from my computer" and "Upload ..." button from the pop up? We need to force the user to only import from an existing folder and to avoid confusion, need to completely remove the "Upload from my computer" section above. What should be changed in the code?
14 April 2009 at 12:37am
seems like, at the moment, the dataobjectmanager is the best (and sometimes only) way to work properly on many_many-Relationships. My question (and I hope it is not that dumb that anyone notices, I'm a relative newbee) is:
Does the DataObjectManager also works with many_many_extraFields? How can these additional attributes to the connecting table be displayed/altered/etc. And despite from that: Is there an other chance to edit these fields? I've found this feature of extraFields nice and important but very few documented.
Bye for now,
14 April 2009 at 1:29am
@sunnyboy -- I've attached a working example of a Resume upload form that is in use on a production site with the latest SWFUpload module. Let me know if there's anything that needs to be updated in the docs.
@amir -- I like the idea. I'll add a $canUpload parameter.
@henning - Can you explain what you mean by extraFields? Sounds interesting. Make sure you're using a ManyManyDataObjectManager for those relations.
|Go to Top||Next >|