I've followed the example listed on [url]http://nuts-and-bolts-of-
cakephp.com/2008/05/13/build-a-string-from-a-resultset-array/[/url] to
build a string to pass to a find IN statement. All looks to work
expect it's encasing the new string in quotes. Here is what I have so
far using cake 1.3.7
[code]
$array = $this->ModelA->find->(‘all’, array($conditions));
$stringOfIds = implode(‘,’, Set::extract($array, ‘{n}.Model.id’));
$conditions = array(‘ModelB.modela_id’ => array($stringOfIds));
$this->data = $this->ModelB->find(‘all’, array(‘conditions’ =>
$conditions));
[/code]
This produces the following SQL
WHERE `Model`.`id` = (’1,19,186′)
It’s putting quotes around the new string an thus not producing the IN
query. I know it’s probably simple, but any ideas what’s causing this
or an easy way to escape the quotes?
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php