Error when trying to declare a variable as a parameter. No problem when i try to declare it inside the function
I have this function:
public static function getOrdini($sort_order = 4)
{
$con = Propel::getConnection();
$sql = "select * from shop_orders LEFT JOIN shop_orders_total
ON
shop_orders.orders_id = shop_orders_total.orders_id
AND
shop_orders_total.sort_order = :sort_order";
$stmt = $con->prepare($sql);
$result = $stmt->execute(array(':sort_order' => $sort_order));
$ordini = self::populateObjects($stmt);
return $ordini;
}
When I call it I get this error:
( ! ) Catchable fatal error: Object of class Criteria could not be converted to string in /home/javier/Aptana_Studio_Workspace/dev_repo/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/DebugPDOStatement.php on line 99
but if write the function in this way below I don't get any error:开发者_运维问答
public static function getOrdini()
{
$sort_order = 4;
$con = Propel::getConnection();
...
Any idea?
Regards
Javi
No bug in the above code it is okay. I tried passing value in the static method and it is fine the error is being generated from the other part of your code checking in the class Criteria
would help you here is nothing in the posted.
Ask to propel, symfony
. here someone is facing the same problem
http://symfonyexperts.com/question/show/id/51
精彩评论