Reputation: 1
I've got a CakePHP 3.0 setup. I've set up a custom route to pass a SKU to a controller, but no matter what I do it doesn't insert the passed argument into the SQL properly.
My route looks like:
$routes->connect('products/:sku', ['controller' => 'Products', 'action' => 'sku'], ['pass' => ['sku']]);
I can find the argument $sku by logging the controller action. But as you can see, in the SQL, the sku is passed as :c0. (Btw I'm passing 'samsung-galaxy-s3' as a SKU).
SELECT `Products`.`id`
AS `Products__id`, `Products`.`attribute_group_id` AS `Products__attribute_group_id`, `Products`.`order`
AS `Products__order`, `Products`.`alias` AS `Products__alias`, `Products`.`stock`
AS `Products__stock`, `Products`.`sku` AS `Products__sku`, `Products`.`price` AS `Products__price`, `Products`.`tax_id`
AS `Products__tax_id`, `Products`.`weight`
AS `Products__weight`, `Products`.`active`
AS `Products__active`, `Products`.`created`
AS `Products__created`, `Products`.`modified`
AS `Products__modified`, `AttributeGroups`.`id`
AS `AttributeGroups__id`, `AttributeGroups`.`name`
AS `AttributeGroups__name`, `Taxes`.`id` AS `Taxes__id`, `Taxes`.`is_default`
AS `Taxes__is_default`, `Taxes`.`name`
AS `Taxes__name`
FROM `products` `Products` INNER JOIN `attribute_groups` `AttributeGroups`
ON `AttributeGroups`.`id` = (`Products`.`attribute_group_id`)
INNER JOIN `taxes` `Taxes` ON `Taxes`.`id` = (`Products`.`tax_id`)
WHERE `Products`.`sku` = :c0
Upvotes: 0
Views: 61
Reputation: 9614
As someone in the comments already said, you are looking at the parameterized query, and not the final query that will be executed to the database. Please look at your DebugKit panel for the final executed query.
Upvotes: 1