iberflow / laravel-model-generator

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

php artisan command getting error #38

Open animeshsarkar-bct opened 7 years ago

animeshsarkar-bct commented 7 years ago

Description:

running > php artisan command getting this error 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)

please help me on this

Steps To Reproduce:

lagbox commented 7 years ago

https://3v4l.org/HcMee

This package would need to up the minimum PHP version as it uses features not available, especially in 5.4.

https://github.com/ignasbernotas/laravel-model-generator/blob/master/src/Commands/MakeModelsCommand.php#L121

animeshsarkar-bct commented 7 years ago

but 1.2.1 works fine if php version or laravel version matters please mention this on readme or change log

lagbox commented 7 years ago

@animeshsa that is because they just added a new tagged version 1.2.2 with changes today.

https://github.com/ignasbernotas/laravel-model-generator/commit/48635b27ba2814b588fb819e2b667a1661ed48f6

lagbox commented 7 years ago

@animeshsa Don't close this issue. Its still an active problem :-) I meant that the changes they made today is what broke this for you. Which is why it was probably working with 1.2.1

animeshsarkar-bct commented 7 years ago

true it ruined my day :(

lagbox commented 7 years ago

@animeshsa if 1.2.1 worked for you, you should be able to tell composer that you want to specifically use 1.2.1 for now.

animeshsarkar-bct commented 7 years ago

yes

rbarrientos182 commented 7 years ago

I have the same problem, my version of Laravel is 5.1.45, php is 7.1.1 and mysql is 5.6.36.

when execute the command "php artisan make:models" my error is the next:

[Symfony\Component\Debug\Exception\FatalErrorException]
parse error

iberflow commented 7 years ago

Hi guys, I will investigate tomorrow. Please be patient and use older tagged versions for now. Also, please post errors with the -vvv option when running the command and paste the full stack trace of errors.

Cheers, Ignas

gvglaok commented 7 years ago

How to solve this problem

cgarnier commented 7 years ago

@ufowiner you can do something like this: php composer.phar require ignasbernotas/laravel-model-generator:1.1.*

jenovachild commented 7 years ago

@rbarrientos182 chances are that you're running a different php cli version than what's being used by your web server.

Running php -v from the command line will tell you what version is running.

php artisan will use the php cli version to complete its tasks. It's important to note that an alias to a different php version will not work and that you need to specifically update the PATH to your installed php.

rbarrientos182 commented 7 years ago

@jenovachild my version running is 5.6.30, but I don't think my version is the problem.

vonFeder commented 7 years ago

My Fix:

Line 121 From: $this->generateTable( ((object) $table)->name ); To: $this->generateTable($table->name);

Line 386 From: return ((object) $primaryKeyResult[0])->COLUMN_NAME; To: return $primaryKeyResult[0]->COLUMN_NAME;

lenh commented 7 years ago

Confirmed that XIIZQ's fixes above worked for me to solve the issue.

iberflow commented 7 years ago

Fixed with 1.2.3