# |
Sep 13th 2009, 08:52 |
nini |
$this->Cat->find('all', array('conditions'=>array( |
# |
Sep 13th 2009, 08:51 |
Miroslav_Vojtu |
please how can i to add find conditions to associated model..... f.e. i hav two models Cat and CatsColor and i need to find only cats with CatsColor.value = blue |
# |
Sep 13th 2009, 08:48 |
nini |
HardPhuck: Hmm. why not to save firm data to another variable, unset all $this->data[Firm] but it's id, then save user, then save firm with viariable created before? |
# |
Sep 13th 2009, 08:47 |
HardPhuck |
relation |
# |
Sep 13th 2009, 08:47 |
HardPhuck |
i would first unbind models, save user data, save firm data, bind models, save relatio |
# |
Sep 13th 2009, 08:46 |
nini |
HardPhuck: ? |
# |
Sep 13th 2009, 08:43 |
nini |
why would you do that? |
# |
Sep 13th 2009, 08:42 |
HardPhuck |
to destroy association while saving Firm data |
# |
Sep 13th 2009, 08:40 |
nini |
for what? |
# |
Sep 13th 2009, 08:40 |
HardPhuck |
let me try:) |
# |
Sep 13th 2009, 08:40 |
HardPhuck |
hmm i can use unbindModel to achieve that |
# |
Sep 13th 2009, 08:24 |
HardPhuck |
thanx for your help |
# |
Sep 13th 2009, 08:22 |
nini |
firm model will not be updated with $this->User->save($this->data) |
# |
Sep 13th 2009, 08:21 |
nini |
yes |
# |
Sep 13th 2009, 08:21 |
HardPhuck |
allright, i have one final question then, how do i update the Firm model at the same time, do another save call? |
# |
Sep 13th 2009, 08:19 |
nini |
yes |
# |
Sep 13th 2009, 08:19 |
nini |
or rename other fields |
# |
Sep 13th 2009, 08:19 |
HardPhuck |
so $this->data['Firm'], should only have one key which is id ? |
# |
Sep 13th 2009, 08:18 |
nini |
you need to pass firm.id only, not more |
# |
Sep 13th 2009, 08:18 |
nini |
but all other firm data comes with |
# |
Sep 13th 2009, 08:18 |
HardPhuck |
it holds the firm.id |
# |
Sep 13th 2009, 08:18 |
HardPhuck |
i am using the hidden input here |
# |
Sep 13th 2009, 08:18 |
nini |
HardPhuck: they using hidden input. didn't you seen it? |
# |
Sep 13th 2009, 08:17 |
nini |
HardPhuck: as in manual http://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM |
# |
Sep 13th 2009, 08:16 |
nini |
yes, becouse you should pass firm.id in your form only, not the full array |
# |
Sep 13th 2009, 08:16 |
HardPhuck |
there |
# |
Sep 13th 2009, 08:16 |
HardPhuck |
only the first value should be inserted other belong to the Firm model and should be inserted theer |
# |
Sep 13th 2009, 08:15 |
HardPhuck |
line 10 is wrong |
# |
Sep 13th 2009, 08:14 |
HardPhuck |
http://bin.cakephp.org/view/1983870909 |
# |
Sep 13th 2009, 08:11 |
primeminister |
damn wrong room |
# |
Sep 13th 2009, 08:11 |
primeminister |
stratos? |
# |
Sep 13th 2009, 08:10 |
nini |
could you paste sql queries that it produces? |
# |
Sep 13th 2009, 08:08 |
HardPhuck |
and assigning it to a firm that is already in the database |
# |
Sep 13th 2009, 08:07 |
HardPhuck |
yes |
# |
Sep 13th 2009, 08:07 |
nini |
HardPhuck: are you creating a new user? |
# |
Sep 13th 2009, 08:01 |
HardPhuck |
i have, several times |
# |
Sep 13th 2009, 08:01 |
HardPhuck |
and the i look at the users_firms table and there is a number of entries with user_id 1 and firm_id holding different data that should be in firms table |
# |
Sep 13th 2009, 08:01 |
nini |
HardPhuck: read habtm manual carefully |
# |
Sep 13th 2009, 07:59 |
HardPhuck |
nini: i then do $this->User->save($this->data); |
# |
Sep 13th 2009, 07:57 |
ta-Labs |
they stink, sorry |
# |
Sep 13th 2009, 07:57 |
ta-Labs |
the ones on cakephp.org are outdated |