$select->join(array('m' => 'media'), "m.foreignKey = p.id and
m.belongsTo='product'", array('mediaType', 'media' => $paths),
$select::JOIN_LEFT);

The on-part of this join produces: `m`.`foreignKey` = `p`.`id` and
`m`.`belongsTo` = `'product'` - the backticks around product are actually
invalid in pdo_mysql. How can I avoid them?

It looks like you want a complex ON part to your JOIN statement.

For anything non-trivial (meaning anything that requires expressions that might contain values or SQL expressions), you may want to use the Expression object to ensure exactly what you want.

Here is an example with an Expression as the ON part:

https://github.com/zendframework/zf2/blob/master/tests/ZendTest/Db/Sql/SelectTest.php#L952-L958

And here is an example of the ON part with predicates and predicate sets:

https://github.com/zendframework/zf2/blob/master/tests/ZendTest/Db/Sql/SelectTest.php#L952-L958


And on a related issue: In Zf1 you were able to provide a data-type with any
query-part, so you were able to actually use optimal data-types for your
database (i.e. an int was treated as int). Now even an int gets quoted,
which hinders performance on columns that contain the int-datatype. Is there

Can you find me some documentation on this assertion? And, which platform you're talking about? (I assume MySQL?)

-ralph

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to