Model override invoke cannot pass more than one parameter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PHPDevShell |
Invalid
|
Undecided
|
Greg |
Bug Description
Using v3 beta4
In somePlugin, setup controller named test.php like this:
<?php
class test extends PHPDS_controller
{
public function execute()
{
$test = $this->
echo '<pre>';
print_r($test);
echo '</pre>';
}
}
return 'test';
Now setup model named test.query.php like this
<?php
class somePlugin_test extends PHPDS_query
{
protected $sql = "
SELECT *
FROM _db_core_settings
WHERE setting_
AND setting_value=%u
";
public function invoke($params)
{
list($x, $y) = $params;
$results = parent::invoke($x, $y);
return $results;
}
}
Now add menu button to link to test.php and click to see error:
vsprintf() [function.
Error building sql for PHPDS_query
Now make the following change... change NOTHING ELSE except change the %u to 1 and it will perform without a problem.
When overriding invoke pass through parameters as array:
public function invoke($params) :invoke( array($ x, $y));
{
list($x, $y) = $params;
$results = parent:
return $results;
}
Greg, can you confirm if a feature to pass parameters through like with invokeQuery is possible?