maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

[make:entity] Cannot create an entity called "Locale"

Open madflow opened this issue 1 year ago • 2 comments

I cannot create an entity called "Locale" on a freshly bootstrapped Symfony project.

symfony new app --version="7.0.*"
cd app
composer require symfony/maker-bundle
composer require symfony/orm-pack
./bin/console make:entity Locale
Your entity already exists! So let's add some new fields!
[critical] Error thrown while running command "make:entity Locale". Message: "Notice: file_get_contents(): Read of 8736 bytes failed with errno=21 Is a directory"

In FileManager.php line 111:

  Notice: file_get_contents(): Read of 8736 bytes failed with errno=21 Is a directory


make:entity [-a|--api-resource] [-b|--broadcast] [--regenerate] [--overwrite] [--] [<name>]

I would argue, that this should be possible.

I can think of a name collision with the global "Locale" class. https://www.php.net/manual/de/class.locale.php

madflow avatar Mar 15 '24 10:03 madflow

It seems to be a side effect of https://github.com/symfony/maker-bundle/pull/1422

smnandre avatar Mar 15 '24 22:03 smnandre

I think #1422 should be reverted, as it contredict the documentation of the method :/

     * @param string $name            The short "name" that will be turned into the class name
     * @param string $namespacePrefix Recommended namespace where this class should live, but *without* the "App\\" part
     * @param string $suffix          Optional suffix to guarantee is on the end of the class

I started something using ReflectionClass::isInternal() , that could help in this specific case. But overall i'm not sure we should change the original behaviour. For the absolute path, it would require using \\ as before, but that was more self-explanatory than today :|

smnandre avatar Mar 15 '24 22:03 smnandre