sebastiaanluca / laravel-auto-morph-map

THIS PACKAGE HAS BEEN DEPRECATED — Automatically alias and map the polymorphic types of Eloquent models.
https://sebastiaanluca.com
MIT License
54 stars 9 forks source link

[Bug] Uses migration when generating map #3

Closed INIFREY closed 5 years ago

INIFREY commented 5 years ago

Hello. When you try to cache maps I have an error.

php artisan morphmap:cache

PHP Fatal error: Cannot declare class CreateSitemapPermissions, because the name is already in use in /project/Modules/Sitemap/Database/Migrations/2019_02_11_124256_create_sitemap_permissions.php on line 35

Symfony\Component\Debug\Exception\FatalErrorException : Cannot declare class CreateSitemapPermissions, because the name is already in use

Logically, a morph map should be created only for entities and not related to migrations.

laravel-auto-morph-map 2.1.0 laravel 5.7 php 7.1.3

sebastiaanluca commented 5 years ago

My apologies that this is taking sooo long to be looked at. It's on my planning, but haven't got to it yet.

Could you perhaps post the autoload section of your composer.json and your morph map config file (if you're using a custom one)? Have a feeling the migrations folder is included in the namespace autoload section.

sebastiaanluca commented 5 years ago

Will close this issue as I need more information to debug this, but it's related to autoloading. Feel free to respond with the requested info and I'll take a look.