Hi all,
I am making filter and having problem with Filter used with prefetched array of possible options. I have mysql table with JSON stored value (list of ID-s)
{"0":"3656","1":"2747","2":"4636","3":"4908","4":"3108"}
Than I do fetch of data using this:
$this->src('automaker')
->query("SELECT odobreni_proizvodjaci AS odoProizvodjaci FROM fuel_users WHERE id = :korisnik")
->params(array(
":korisnik"=>$this->params["korisnik"]
))
->pipe($this->dataStore("tempproizvodjaci"))
->requestDataSending();
$odoProizvodjaci = $this->dataStore("tempproizvodjaci")->data()[0]["odoProizvodjaci"];
$proizvodjaci = json_decode($odoProizvodjaci, true);
$privremenArr = array();
foreach ($proizvodjaci as $value) {
array_push($privremenArr, intval($value));
}
// $privremenArr = array(1720,3281,3595);
And at the end I am using filter like so:
->pipe(new Filter(array(
array("Proizvodjac","in",$privremenArr),
)))
The thing is that this does not work. If I uncomment // $privremenArr = array(1720,3281,3595); it does work. I have tried different options and still no luck.
For the test only, I've added code below in the view directly and it works as supposed to (not what I want but shows data)
$odoProizvodjaci = $this->dataStore("tempproizvodjaci")->data()[0]["odoProizvodjaci"];
//$proizvodjaci = array(1720,3281,3595);
$proizvodjaci = json_decode($odoProizvodjaci, true);
$privremenArr = array();
echo '<select id="proizv" name="proizv" class="form-control">';
foreach ($proizvodjaci as $value) {
//array_push($privremenArr, intval($value)+1);
echo '<option value="sve">'.$value.'</option>';
}
//print_r($privremenArr[1]);
echo '</select>';
Would anyone know how to get this working?