iberflow / laravel-model-generator

Laravel 5 model generator for an existing schema
264 stars 76 forks source link

Fix ErrorException: Trying to Get Property of Nonobject #37

Closed jacobsantos closed 7 years ago

jacobsantos commented 7 years ago

Cast variable to object to force when array.

iberflow commented 7 years ago

So without these changes it doesn't work in L5.3? Seems like the casting is redundant.

jacobsantos commented 7 years ago

Casting might be redundant when it works, but it doesn't work with PHP7 and Laravel 5.3.x.

The variable is an array when it is returned. I noticed the event, but I haven't looked into why the event is working or if it is even running.

iberflow commented 7 years ago

released with 1.2.2 :) thanks!

jaripekkala commented 7 years ago

https://github.com/laravel/framework/issues/18396

animeshsarkar-bct commented 7 years ago

$ php artisan PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in C:\xampp\htdocs\ctw-portal\vendor\ignasbernotas\laravel-model-generator\src\Commands\MakeModelsCommand.php on line 121

[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected '->' (T_OBJECT_OPERATOR)

jacobsantos commented 7 years ago

This PR should work with PHP 5.5.9 as the syntax should have been supported since PHP 5.4 or PHP 5.5. I checked 3v4l.org and yeah, this works on PHP7 and above. You have to cast on another line.

Do you want me to use this PR or create a new PR?

jacobsantos commented 7 years ago

See #39 for fix.