Skip to content

Model.php Return Type Object causes Error when Saving. (Fixed with this modification) #329

Description

@timothymarois

Currently if you use your models to return data types of object instead of array, you will be hit with an error once you try to use the save() method.

When checking if its an object is_object, its looking for a non-stdClas. To resolve these in model.php you need to remove all the !

if (is_object($data) && ! $data instanceof \stdClass)
{
     $data = $this->classToArray($data);
}

Corrected by:

if (is_object($data) && $data instanceof \stdClass)
{
     $data = $this->classToArray($data);
}

Otherwise you end up with Cannot use object of type stdClass as array This needs to be fixed on the save() , insert() , and update() methods.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions