It’s driving me mad! It’s probably some typo again somewhere but’t I can’t find the problem.
Trying to call a function in the controller from the view, but I only get:
"Missing argument 1 for ProductionordersController::getPrerequisite(), called in C:\xampp\htdocs\framework\base\CComponent.php on line 112 and defined"
The controller:
public function getPrerequisite($order)
{
$notpossible = false;
$criteria = new CDbCriteria;
$criteria->condition = 'primaryorder = :id';
$criteria->params = array(':id'=>$order);
$orderstructures = Orderstructures::model()->findAll($criteria);
foreach($orderstructures as $structure)
{
if($structure->suborder0->status->displaycategory == 1)
$notpossible = true;
}
if($notpossible)
return 'En eller flera underliggande produkter är ännu inte färdiga!';
}
I wonder if the issue has to do with the fact that you are taking an argument? I have two kinds of methods in my /model/ file: if I don’t include the get with methods that require an argument, I also get the “missing argument error”: if I include the “get”, the error vanishes.
The problem is you’re treating getPrerequisite() as a virtual property when it’s actually just a normal method that happens to start with “get”, it’s not a true getter because its argument is not optional.