Don't use mass assignment in hydrator.
This commit is contained in:
@@ -112,7 +112,17 @@ class Query {
|
|||||||
{
|
{
|
||||||
$result = (array) $result;
|
$result = (array) $result;
|
||||||
|
|
||||||
$models[$result[$this->model->key()]] = new $class($result, true);
|
$new = new $class(array(), true);
|
||||||
|
|
||||||
|
// We need to set the attributes manually in case the accessible property is
|
||||||
|
// set on the array which will prevent the mass assignemnt of attributes if
|
||||||
|
// we were to pass them in using the constructor or fill methods.
|
||||||
|
foreach ($result as $key => $value)
|
||||||
|
{
|
||||||
|
$new->$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$models[$result[$this->model->key()]] = $new;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($include and count($results) > 0)
|
if ($include and count($results) > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user