What is the difference between using
$model->name = 'bob';
and
$model->setAttribute('name', 'bob');
Thanks
What is the difference between using
$model->name = 'bob';
and
$model->setAttribute('name', 'bob');
Thanks
Nice question
The former calls magic __set(), while the latter assigns the value right to the attributes array (and raises the exception if something goes wrong).
As for me, I redefine __set and __get sometimes, so I can exploit this.