I'm trying to use a Model in a Component, so I'm registering it like this:
/*
// __facetConditions: Assembles subqueries for each facet/value pair
// @var arr $facets: Array of facet/value pair arrays
// @data arr $conditions: Model-usable array of subqueries.
*/
private function __facetConditions($facets) {
$fif = ClassRegistry::init('FacetedItemsFacet');
$conditions = array();
$aCount = 2;
// We need to create a subquery for every facet/value pair:
foreach($facets as $key=>$value) :
$subq = $fif->subquery(Yadda Yadda Yadda);
$conditions[] = '`FacetedItemsFacet`.`faceted_item_id` IN (`' . $subq . '`)';
$aCount++;
endforeach;
return $conditions;
}
However, even though the subquery function is definitely available and working and being used in *this same function* elsewhere, I'm getting a message that: "
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'subquery' at line 1"I understand that this is because CakePHP doesn't recognize the function name and so is just passing it as the query string. But why does it work in another context?
-- 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:
Post a Comment