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.

Customising the CMS /

image relationships with ModelAdmin in 2.3


Reply


3 Posts   1191 Views

Avatar
squared99

Community Member, 12 Posts

7 January 2009 at 3:36pm

Hey All,

Having a lot of fun with customizing the CMS and been stoked with progress so far on some cms migration work Ive been doing. Everything is fitting together nicely!

A couple of questions issues I came across.

Has anyone else had problems with the image relationships in 2.3 with ModelAdmin? ie I have a custom data object and I add the has_one relationships as well as the cms field. When I run the dev/build?flush=1 it says it has added the id fields and indices, but when I check the db it hasnt. This stops it being able to attach the image as an error is thrown indicating there is no id for the image field.

Everytime I run dev/build?flush=1 it says it is adding the fields and indices but it never does. I guess if it had it wouldnt keep repeating that it had. Other db fields get added with no issues.

Secondly, somewhat related. I am trying to grab the filepath of the images directly after upload for some post upload processing but cant see the path in the form or data objects in doSave, it shows the form field names for the images but they are blank. Wondering if this due to the problem above?

I am running the 2.3 grabbed from subversion today (07/01/09)

Cheers!

Avatar
Sam

Administrator, 685 Posts

7 January 2009 at 5:28pm

If the field isn't being created in the database then the problem is with dev/build and not model admin.

Try changing your site into dev mode (http://doc.silverstripe.com/doku.php?id=debugging#dev_mode) and running dev/build again. Do you get an error message at the bottom?

Avatar
squared99

Community Member, 12 Posts

8 January 2009 at 11:57am

oops,

Thanks Sam. I had debugging enabled originally but had forgot to put it back in when I did a fresh install.
Turned it on, found the problem and got it sorted. Stupid syntax error that took a second to fix.

Sorry about that.