Awesome, glad you figured it out!
On Saturday, February 25, 2012 10:48:59 AM UTC-8, Kro wrote:
>
> Thank you so much, it's working now! You were spot on, it was the
> Couplers beforesave that was unsetting the data. I have stopped it
> doing that now and I can't see why that would cause any other issues.
>
>
>
>
> The change I have made is as follows:
> function beforeSave(&$Model) {
> if (!$Model->exists()) {
> if (!isset($Model->data[$Model->alias]['file'])) {
> removed unset --->
> //unset($Model->data[$Model-
> >alias]);
> return true;
> }
> } else {
> if (isset($Model->data[$Model->alias]['delete'])
> && $Model->data[$Model->alias]['delete'] !== '0')
> {
> $Model->delete();
> unset($Model->data[$Model->alias]);
> return true;
> }
> }
>
>
> Thanks again...
>
>
>
> On Feb 24, 5:48 pm, jeremyharris <[email protected]> wrote:
> > Okay I think I misspoke. You do need the coupler. (Sorry lack of docs
> and
> > it's been a while since I had to configure.)
> >
> > I'd stick some debug statements through all of the behaviors' beforeSave
> > calls to try and figure out what's happening. I'm suspicious that the
> rate
> > data is being removed in Coupler's beforeSave due to some issue with the
> > 'file' key not being there or not being validated. This will hopefully
> give
> > you a better understanding of what's going on.
> >
> >
> >
> >
> >
> >
> >
> > On Friday, February 24, 2012 1:02:05 AM UTC-8, Kro wrote:
> >
> > > Thanks for your reply. Okay, sounds like it could be related to the
> > > Coupler then. I tried removing the Coupler and the 'Rate' data is then
> > > saving correctly but the image is missing. I am using 'dirname' and
> > > 'basename' fields in the 'Rate' table rather than using a separate
> > > Attachment table, does this mean I don't need the Coupler element?
> >
> > > On Feb 24, 2:19 am, jeremyharris <[email protected]> wrote:
> > > > What behaviors are you using besides Transfer? Coupler tends to mess
> > > with
> > > > the data because it expects *just* the fields in the
> Media.Attachment
> > > > model. Try removing Coupler if it's attached (since you're not using
> > > it).
> >
> > > > Also, unit tests are your friend. It would be much easier to try
> things
> > > and
> > > > debug using unit tests rather than not.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php