# |
Aug 7th 2008, 01:10 |
polerin |
so it's existance is not a dead give |
# |
Aug 7th 2008, 01:10 |
polerin |
only reason I'm suggesting the call to exists() is for models that don't have an auto-incrementing or creating id field, you'd obviously need to have the id for the insert |
# |
Aug 7th 2008, 01:10 |
polerin |
Traveler6: I'm sure there is a MUCH better way of doing it, but that's about the best I can give you at 1:30 in the morning and no time to go digging in code |
# |
Aug 7th 2008, 01:09 |
polerin |
Traveler6: there is probably better way to do it, and if you dig into the model source you can likely find it, but first off I would check for the existance of the model's id field in the data. If it's not there it's likely that it's a insert... if it is there genrally it's going to be an update, but you can check by calling exists() |
# |
Aug 7th 2008, 01:08 |
TonkaTruck |
Eddie_CRO: That last sentence of the containable page contains some very key info....that contain() can use standard Model->find() options. |
# |
Aug 7th 2008, 01:07 |
Eddie_CRO |
ok, will try. |
# |
Aug 7th 2008, 01:07 |
Eddie_CRO |
aaaa |
# |
Aug 7th 2008, 01:07 |
TonkaTruck |
Eddie_CRO: I didn't even notice that when you originally pasted it. |
# |
Aug 7th 2008, 01:07 |
Traveler6 |
like I want to have a check in the controller |
# |
Aug 7th 2008, 01:06 |
Traveler6 |
i want to perform some actions if the user is updating a row. but i want to be able to do it globally, and not have to put code in the admin_edit admin_add fields etc.. |
# |
Aug 7th 2008, 01:06 |
TonkaTruck |
Eddie_CRO: See the very end of this page: http://book.cakephp.org/view/474/containable |
# |
Aug 7th 2008, 01:06 |
Eddie_CRO |
i didn't understand it that way. wait to try. |
# |
Aug 7th 2008, 01:06 |
Eddie_CRO |
hm |
# |
Aug 7th 2008, 01:05 |
TonkaTruck |
Eddie_CRO: I just noticed something. Where you have 'Category' => array() < that array should have 'conditions' => array('Group.name' => 'some_name') right? |
# |
Aug 7th 2008, 01:05 |
polerin |
Traveler6: ask the question more specifically, what problem are you having or are trying to solve? |
# |
Aug 7th 2008, 01:04 |
poluta1 |
hello anybody know how to make ajax observeField stay selected if a user submitting form, and user forget to fill valid email |
# |
Aug 7th 2008, 01:04 |
Eddie_CRO |
tonka: yes, but how to do that then? |
# |
Aug 7th 2008, 01:03 |
polerin |
becasue it is full of win and absolute awesome. |
# |
Aug 7th 2008, 01:03 |
polerin |
btw, have I publicly stated my deep and abiding love for vim's "visual block" recently? |
# |
Aug 7th 2008, 01:03 |
TonkaTruck |
Eddie_CRO: That was a problem I encountered. I thought "I want a list of topics in a forum" so my find() should be Topic->find() but with contain and recursive I could see a nice way to get it. So I want backwards to the Forum model and contained down from there. |
# |
Aug 7th 2008, 01:02 |
Traveler6 |
basically i want to use beforeSave in the controller |
# |
Aug 7th 2008, 01:02 |
Traveler6 |
how do i check if the table is being updated or a new one added in the controller |
# |
Aug 7th 2008, 01:01 |
Eddie_CRO |
right? |
# |
Aug 7th 2008, 01:01 |
Eddie_CRO |
yes, and try now limiting this with something from ForumPost. And doing so, you expect find not to return you records of Forum if FormPost criteria is not fulfilled. |
# |
Aug 7th 2008, 01:00 |
TonkaTruck |
This is to view a list of topics in a forum. So I start at Forum and get the topics in that forum. For each topic I get the user who created the topic and a the last forumpost for that topic as well as the user who posted it. |
# |
Aug 7th 2008, 00:59 |
poluta1 |
hello anybody know how to make ajax observeField stay selected if a user submitting form, and user forget to fill valid email |
# |
Aug 7th 2008, 00:57 |
Eddie_CRO |
yes but with some forumpost conditions, right? |
# |
Aug 7th 2008, 00:57 |
TonkaTruck |
I want the forum record. |
# |
Aug 7th 2008, 00:57 |
Eddie_CRO |
what else?! |
# |
Aug 7th 2008, 00:57 |
Eddie_CRO |
you don't want records for Forum if it doesn't have that specific ForumPost condition. |
# |
Aug 7th 2008, 00:57 |
TonkaTruck |
Yes. I'm assuming because I'm doing $this->Forum->find() |
# |
Aug 7th 2008, 00:57 |
Eddie_CRO |
which is not what you want |
# |
Aug 7th 2008, 00:57 |
Eddie_CRO |
yes but you get the record for Forum. |
# |
Aug 7th 2008, 00:56 |
TonkaTruck |
I get an empty forumpost array if there are no forumposts for that topic. |
# |
Aug 7th 2008, 00:55 |
Eddie_CRO |
just with empty FormPost array. |
# |
Aug 7th 2008, 00:55 |
Eddie_CRO |
it seems it does. |
# |
Aug 7th 2008, 00:55 |
Eddie_CRO |
and check if it gives you the Forum record back although it doesn't contain formpost's condition. |
# |
Aug 7th 2008, 00:54 |
Eddie_CRO |
Tonka: yes, but try to put in the last array a condition like FormPost.somefield = somevalue |
# |
Aug 7th 2008, 00:53 |
polerin |
which is usefull, because it meens that you can specify conditions for things that are on the other side of a multi-select find |
# |
Aug 7th 2008, 00:53 |
TonkaTruck |
Also note 'recursive' in the find() itself. |
# |
Aug 7th 2008, 00:53 |
polerin |
it goes with the Class model |