← Back to team overview

phpdevshell team mailing list archive

[Bug 689063] Re: Model override invoke cannot pass more than one parameter

 

When overriding invoke pass through parameters as array:

public function invoke($params)
 {
 list($x, $y) = $params;
 $results = parent::invoke(array($x, $y));
 return $results;
 }

Greg, can you confirm if a feature to pass parameters through like with
invokeQuery is possible?

** Changed in: phpdevshell
   Importance: Undecided => Wishlist

** Changed in: phpdevshell
     Assignee: (unassigned) => Greg (gregfr)

-- 
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.
https://bugs.launchpad.net/bugs/689063

Title:
  Model override invoke cannot pass more than one parameter

Status in Open Source PHP RAD Framework with UI.:
  New

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->db->invokeQuery('somePlugin_test', 'PHPDevShell_access_logging', '1');
 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_description='%s'
 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.vsprintf]: Too few arguments
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.





References