Does the containable behavior apply for insert too?
In theory, bind/unbind should work according to documentation, no?
I will look more into contanable, it was next on my list to explore. Thank you
On Wed, Jan 27, 2010 at 9:39 AM, Jeremy Burns <jeremyburns@me.com> wrote:
You can set recursion and containment restrictively in app_model:var $actsAs = array('Containable');var $recursive = -1;...then undo it as you need. Take a look at the section on the contain behaviour in the online book - http://book.cakephp.org/view/474/Containable - I'd recommend adopting it wholeheartedly. Once you get to grips with it you'll love it.
Jeremy Burns(Skype) +44 208 123 3822 (jeremy_burns)(m) +44 7973 481949(h) +44 208 530 7573On 27 Jan 2010, at 15:31, yazan suleiman wrote:Thats a very good question. In fact, I am still exploring CakePHP and trying to find out more about the ins and outs. Anyway. I did that and it worked. However, my reasoning for not using associations in the model was the following:
If I do use association the model, then any select on Users table (model) will fetch the rest of the associated tables. I know about recursive and I can specify its value. But I am using Auth and the login function fetch everything associated to users eventhough it only needs username and password. In addition What if I only want a user and his/her profile, can I exclude Resume. So these are the questions I had and didnot know the answer to. So I thought my best route is to bind/unbind these associations. Please let me know whether my reasoning is not valid. And thank you for your reply.
On Wed, Jan 27, 2010 at 9:24 AM, Jeremy Burns <jeremyburns@me.com> wrote:Can I pose the question "Why are you not defining associations in your models?" They are incredibly powerful.
Jeremy Burns
jeremyburns@me.com
(Skype) +44 208 123 3822 (jeremy_burns)
(m) +44 7973 481949
(h) +44 208 530 7573
On 27 Jan 2010, at 04:36, YS wrote:
> I am very new to cakephp and having problems understanding bindModel.
> I have read the documentation several times but bindModel is not
> behaving as I expect. This is my issue:
>
> I have user who has one profile and one resume. I am storing resume
> in a separate table and I am not defining association in my models and
> only using binding 'bindModel'. In my controller I do the following:
>
> $this->User->bindModel(array('hasOne' => array('Profile', 'Resume')));
> if ($this->User->saveAll($this->data, array('validate'=>'first'))){
> ........
> }
>
> So I get the following error (the error is referring to Resume):
>
> Warning (512): SQL Error: 1364: Field 'user_id' doesn't have a default
> value. I know I am doing something wrong because this behavior does
> not match the one in the documentation (examples). I cannot figure
> out where the problem is however.
>
> I was not sure what other information you may need to look into this
> and thought the above is sufficient for now. (let me know if you need
> more information).
>
> Any help is really appreciated.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment