Tuesday, June 11, 2013

Re: Created and Modified Dates don't auto populate on HABTM

How did you go around that finally? i am in the same point right now.

thanks

On Friday, February 18, 2011 3:33:35 PM UTC+1, rgreenphotodesign wrote:
Thanks for taking a look guys. I knew there was reason why it made
sense to me that the dates weren't populating, just wasn't sure if
there was a work around.

Thanks for the advice, I'll get it set with the join model and go from
there. Thanks again.

On Feb 17, 3:10 pm, euromark <dereurom...@googlemail.com> wrote:
> yep
> you will need to develop your own HABTM behavior that will take care
> of that
> because john is right, in the default HABTM table, only the primary
> keys of the two joined tables are allowed
> something I regretted as well in the past
> but you can easily work around it - manually :)
>
> On 17 Feb., 22:10, John Andersen <j.andersen...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I do think that you need to take a look at The Join Model in the
> > CakePHP book at:http://book.cakephp.org/#!/view/1650/hasMany-through-The-Join-Model
>
> > as what you want is to have additional data in your intersection table
> > and CakePHP normal usage does not allow that.
> > Whether or not it will be able to automatically populate the created
> > and modified columns is not something I am sure about though!
> > Enjoy,
> >    John
>
> > On Feb 17, 5:19 pm, rgreenphotodesign <rgr...@rgreenphotography.com>
> > wrote:
>
> > > Just for good measure here are my relationships in the models:
>
> > > Activity:
>
> > >         var $hasAndBelongsToMany = array(
> > >                 'Statustype' => array(
> > >                         'className' => 'Statustype',
> > >                         'joinTable' => 'activity_statuses',
> > >                         'foreignKey' => 'activities_id',
> > >                         'associationForeignKey' => 'statustypes_id',
> > >                         'unique' => false,
> > >                         'conditions' => '',
> > >                         'fields' => '',
> > >                         'order' => '',
> > >                         'limit' => '',
> > >                         'offset' => '',
> > >                         'finderQuery' => '',
> > >                         'deleteQuery' => '',
> > >                         'insertQuery' => ''
> > >                 ),
> > >         );
>
> > > ActivityStatus:
>
> > >         var $belongsTo = array(
> > >                 'Statustype' => array(
> > >                         'className' => 'Statustype',
> > >                         'foreignKey' => 'statustypes_id',
> > >                         'conditions' => '',
> > >                         'fields' => '',
> > >                         'order' => ''
> > >                 ),
> > >                 'Activity' => array(
> > >                         'className' => 'Activity',
> > >                         'foreignKey' => 'activities_id',
> > >                         'conditions' => '',
> > >                         'fields' => '',
> > >                         'order' => ''
> > >                 ),
> > >         );
>
> > > I don't define any relationships in the Statustype model.
>
> > [snip]

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: