Hi all,
I want to set an array as model's property as below:
class MyModel extends BaseModel
{
protected foo_bar;
public function getFooBarr()
{
return is_null($this->foo_bar) ? [] : unserialize($this->foo_bar);
}
public function setFooBarr(array $foo_bar)
{
$this->foo_bar = serialize($foo_bar);
}
}
$model = new MyModel();
$model->foo_bar = ['foo', 'bar'];
var_dump($model->foo_bar); // Result: array (size=0) empty
as this section of source, there is no way to assign array to some model's property without fall in models's relation an lazy loading/setting!
I think this is a bug! the lazy loadings/settings and direct setting/loadings should be separate!
Any idea or workaround to this problem?
Thanks.