Comments on: CakePHP tip of the day: pay attention to conventions /cakephp/cakephp-tip-of-the-day-pay-attention-to-conventions/ A glimpse at a coder's troubled mind Tue, 21 Jun 2011 13:27:40 +0000 hourly 1 http://wordpress.org/?v=3.2.1 By: Let them eat cake » UPDATE statt INSERT /cakephp/cakephp-tip-of-the-day-pay-attention-to-conventions/comment-page-1/#comment-1461 Let them eat cake » UPDATE statt INSERT Wed, 28 Apr 2010 15:36:15 +0000 /1/cakephp-tip-of-the-day-pay-attention-to-conventions/#comment-1461 [...] allerdings nicht – Cake erstellt trotzdem stur neue Einträge. Eine Google Suche brachte die Lösung. Cake prüft die Existenz von Einträgen während des Validierens. Der richtige Callback für [...] [...] allerdings nicht – Cake erstellt trotzdem stur neue Einträge. Eine Google Suche brachte die Lösung. Cake prüft die Existenz von Einträgen während des Validierens. Der richtige Callback für [...]

]]>
By: Mark De Verno [Visitor] /cakephp/cakephp-tip-of-the-day-pay-attention-to-conventions/comment-page-1/#comment-108 Mark De Verno [Visitor] Thu, 02 Apr 2009 19:10:00 +0000 /1/cakephp-tip-of-the-day-pay-attention-to-conventions/#comment-108 Nice article, but I agree with Daniel. As you are explicitly passing in the id of the data, Cake should update, not insert. Nice article, but I agree with Daniel. As you are explicitly passing in the id of the data, Cake should update, not insert.

]]>
By: Daniel Hofstetter [Visitor] /cakephp/cakephp-tip-of-the-day-pay-attention-to-conventions/comment-page-1/#comment-107 Daniel Hofstetter [Visitor] Thu, 25 Oct 2007 11:12:00 +0000 /1/cakephp-tip-of-the-day-pay-attention-to-conventions/#comment-107 Well, if the first example you described really does an insert instead of an update (I didn't test it myself), then I have to say it is a bug. If I explicitly pass the id in the data I want to save, then Cake should use this id, and not assume something else.<br /> <br /> What you described is an unwanted side effect of the validates() function. If you omit calling this function, it would update the record, right? So the behavior of the save() function depends on whether I call validates() first. In one case the save() function will insert the data, in the other case it updates the record, even though in both cases the same data is provided. Hm, sounds like a bug to me ;-) Well, if the first example you described really does an insert instead of an update (I didn’t test it myself), then I have to say it is a bug. If I explicitly pass the id in the data I want to save, then Cake should use this id, and not assume something else.

What you described is an unwanted side effect of the validates() function. If you omit calling this function, it would update the record, right? So the behavior of the save() function depends on whether I call validates() first. In one case the save() function will insert the data, in the other case it updates the record, even though in both cases the same data is provided. Hm, sounds like a bug to me ;-)

]]>
By: sarimarton [Visitor] /cakephp/cakephp-tip-of-the-day-pay-attention-to-conventions/comment-page-1/#comment-106 sarimarton [Visitor] Tue, 23 Oct 2007 23:43:00 +0000 /1/cakephp-tip-of-the-day-pay-attention-to-conventions/#comment-106 Great article, thank you! Great article, thank you!

]]>