Hi. I am having some trouble with 2 MultiSelect widgets. Pdo is throwing error "PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :cashbox_param0"
Only one of them is working fine. Can You pls help me, what am I doing wrong.
Here is the code from the model:
protected function defaultParamValues()
{
return array(
"dateRange" => array(
"2018-10-10",
"2018-10-11"
),
"cashbox" => array(),
"moneyTypes" => array(),
);
}
protected function bindParamsToInputs()
{
return array(
"dateRange" => "dateRange",
"cashbox" => "cashbox",
"moneyTypes" => "moneyTypes",
);
}
function setup()
{
$sql = $this->buildSql();
$this->src('mydata')
->query($sql)
->params(array(
":startDate" => $this->params["dateRange"][0],
":endDate" => $this->params["dateRange"][1],
":cashbox" => $this->params["cashbox"],
":moneyTypes" => $this->params["moneyTypes"],
))
->pipe(new Pivot(array(
"dimensions" => array(
"column" => "",
"row" => "cashbox, currency_type, date",
),
"aggregates" => array(
"sum" => "init_balance, income, outcome, final_balance",
),
)))
->pipe($this->dataStore('mydata'));
$this->src('mydata')
->query('SELECT id, name FROM kassa')
->pipe($this->dataStore('cashboxData'));
$this->src('mydata')
->query('SELECT id, name FROM money_types')
->pipe($this->dataStore('moneyTypes'));
}
Code from view:
<div class="form-group">
<?php
DateRangePicker::create(array(
"name"=>"dateRange"
))
?>
</div>
<div class="form-group">
<?php
MultiSelect::create(array(
"name"=>"cashbox",
"dataStore"=>$this->dataStore("cashboxData"),
"dataBind"=>array("text"=>"name","value"=>"id"),
"multiple"=>true,
"attributes"=>array(
"class"=>"form-control",
"size"=>4,
)
));
?>
</div>
<div class="form-group">
<?php
MultiSelect::create(array(
"name"=>"moneyTypes",
"dataStore"=>$this->dataStore("moneyTypes"),
"dataBind"=>array("text"=>"name","value"=>"id"),
"multiple"=>true,
"attributes"=>array(
"class"=>"form-control",
"size"=>2,
)
));
?>
</div>