7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Migrating from Has-many File Manager to DataObject Manager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1451 Views |
-
Migrating from Has-many File Manager to DataObject Manager

3 June 2010 at 8:15pm
Hi all,
I'm considering replacing the Has-many File Manager module on my site with the DataObject Manager. Has anyone else done this?
On my company site I am currently displaying images using this code:
<% if AttachedFiles(MyImages) %>
<div id="imgGallery">
<% control AttachedFiles(MyImages) %>
<% if First %><a href="$URL" title="$Title" rel="lightbox" class="storbild">$SetWidth(370)</a><% end_if %>
<a href="$URL" title="$Title" class="miniatyr">$SetWidth(80)</a>
<% end_control %>
</div>
<% end_if %>This shows the first image attached to the page as a large preview, and the following images as miniatures beneath it.
How would one accomplish the same thing using the DataObject Manager?
Yours,
Måns -
Re: Migrating from Has-many File Manager to DataObject Manager

4 June 2010 at 1:45am
DOM is not a frontend tool -- it's used in the backend to manage your data relationships, so the only difference is that you would have a more robust interface for uploading/managing your file objects in the CMS.
-
Re: Migrating from Has-many File Manager to DataObject Manager

4 June 2010 at 2:08am
So the code can stay exactly the same? Excellent!
Is DOM fully compatible with SS 2.4.0? I thought I'd upgrade while I'm at it.
Yours,
Måns -
Re: Migrating from Has-many File Manager to DataObject Manager

4 June 2010 at 2:48am
No, totally different code. The big difference between FileDOM and HasManyDOM, from a code standpoint, is that HasManyDOM requires you to decorate your File object for custom fields, while a FileDOM manages DataObjects that contain files, e.g.
MyUploadable extends DataObject
{
static $db = array (
'CustomField' => 'Text',
'AnotherCustomField' => 'Varchar'
etc..
);static $has_one = array (
'File' = 'File'
);public function getCMSFields() {
// etc..}
} -
Re: Migrating from Has-many File Manager to DataObject Manager

7 December 2010 at 11:09pm
Sorry for digging out an old thread. I stumbled across this and thought I might add a link to a solution on how to migrate Has-many File Manager to DOM: http://silverstripe.org/all-other-modules/show/14630
Just in case anybody else finds this thread.
| 1451 Views | ||
|
Page:
1
|
Go to Top |


