Reputation: 353
Littered throughout Magento you can find constructs similar to
$select->joinLeft(
array('c' => $couponTable),
'c.customer_id=root.entity_id AND c.rule_id=:rule_id',
array('c.coupon_id')
);
What does the binary operator =: do?
Upvotes: 0
Views: 221
Reputation: 13812
It's part of a prepare statement. Take a look at PDO's prepare
<?php
/* Execute a prepared statement by passing an array of values */
$sql = 'SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
?>
So somewhere else it's binding a value to that variable... something like
$select->execute(array(":rule_id" => "someValue"));
Upvotes: 2
Reputation: 21194
=:
is not an operator. The operator is =
only, which checks for equality. :rule_id
is an identifier, which is used by prepared SQL statements to refer to a parameter. See prepared statements for more information.
Upvotes: 5