Monday, March 5, 2012

SqlQueries in Fields to save?

Hi there,

I know this could be a critical hole in my application,
anyhow - is there a way to set an article-id like this?
I can not assign auto_increment to this table AND I only want to do
one query (because there could be several save querys parallel).

$this->Article->create();
$data['Article']['text'] = 'blah';
$data['Article']['id] = '(SELECT `id` FROM `Article` ORDER BY `id`
DESC LIMIT 1) + 1';
$this->Article->save($data);

Obviously (and thankfully) cakePHP does not handle this as a query,
but how would you solve this issue?

Any hints are welcome!

Andreas

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: