Leandro Lucarella, el 20 de abril a las 23:58 me escribiste:
>
> GreyCells, el 20 de abril a las 15:25 me escribiste:
> >
> > $this->Person->set('name', null); before saving.
>
> 2 comments:
> 1) The table is really much bigger than a single "name" field (~60
> fields). Even when I can do the set()-thing programatically with a
> foreach over the $this->data, I find it annoying and unnecessary (if I
> have a "" for a field in my associative array is because I want to set
> the DB field to "", not avoid the update).
> 2) I don't want to make it NULL (I don't know if this is what it does
> $this->Person->set('name', null), but my wild guess it that it is).
>
> It's really no way to save an associative array "as-is" into the DB?
Ok, this was a bug in my code. But I think it was triggered becuse I'm not
using right the save() method. Does save() handles relations? I have an
internationalized website with some entities that 'hasMany' descriptions
(each one in a supported language). When somebody edits the entity, it
edits all his descriptions too (there are a few languages supported, so
it's not a big deal). I'm doing something like:
$this->Entity->save($this->data);
$this->Entity->Description->save($this->data['DescriptionEn']);
$this->Entity->Description->save($this->data['DescriptionEs']);
(simplified)
My problem was I wasn't checking if the save() call was successfull on the
descriptions, so now I'm trying to do it but I realize that if, for
example, the DescriptionEs save() fails, I should rollback the two
previous save() calls.
Is there any way to pass the Entity data with it's relations so it's all
saved toguether? I there a way to wrap all that in a transaction so if any
validation fails, the transaction could be rolled back?
TIA
--
LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
------------------------------------------------------------------------
E-Mail / JID: [EMAIL PROTECTED]
GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2
GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
------------------------------------------------------------------------
More people die from a champagne-cork popping,
than from poison spiders
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---