我在我的 magento 数据库中编写了一个 mysql 存储过程来执行复杂的操作,并想在我的 magento 代码中使用它们。我能够从我的 magento 代码中调用该过程并在数组中获取结果集。现在我想使用这个结果集作为模型来使用 joinattribute 进行进一步的连接,或者更具体地说,我想将这个输出结果集从存储过程传输到一个集合中,以便我可以使用 getcollection 方法。我该怎么做?
最佳答案
来自thread on joining procedure results :
> Is it possible to join a table on the results from a stored procedure within a single query?
No.
所以看起来你必须做很长的路要走,并使用数组作为参数。
// $collection is a collection
// $results is the stored procedure results as an array
$collection->addAttributeToFilter('ATTRIBUTE_NAME', array('in'=>$results));
有关集合的类似技巧,请参阅“其他比较运算符”here .
关于mysql - Magento - 使用存储过程数组结果集作为集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6894537/