Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » image relationships with ModelAdmin in 2.3

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1061 Views
  • squared99
    Avatar
    Community Member
    12 Posts

    image relationships with ModelAdmin in 2.3 Link to this post

    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!

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: image relationships with ModelAdmin in 2.3 Link to this post

    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?

  • squared99
    Avatar
    Community Member
    12 Posts

    Re: image relationships with ModelAdmin in 2.3 Link to this post

    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.

    1061 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.