You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your entity already exists! So let's add some new fields!
In FileManager.php line 111:
Warning: file_get_contents(/project/path/): Failed to open stream: No such file or directory
make:entity [-a|--api-resource] [-b|--broadcast] [--regenerate] [--overwrite] [--with-uuid] [--with-ulid] [--] [<name>]
Possible Solution
The issue seems to come from line 191 of the Generator class in the maker bundle:
This check verifies if the entered class already exists, but not using namespacePrefix value.
However, since PHP 8, the Attribute class exists for managing class attributes (vs annotations).
<?phpnamespaceExample;
useAttribute;
#[Attribute(Attribute::TARGET_METHOD)]
class MyAttribute
{
}
The check should be modified to verify that the class exists in the namespace.
What do you think?
Additional Context
Here is the output of the make:entity command in verbose mode.
symfony console make:entity Attribute -vvv
Linting Generated Files With:
Bundled PHP-CS-Fixer & Bundled PHP-CS-Fixer Configuration
Your entity already exists! So let's add some new fields!In FileManager.php line 111: [ErrorException] Warning: file_get_contents(/project/path/): Failed to open stream: No such file or directoryException trace: at /project/path/vendor/symfony/maker-bundle/src/FileManager.php:111 Symfony/Bundle/MakerBundle/FileManager->getFileContents() at /project/path/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php:851 Symfony/Bundle/MakerBundle/Maker/MakeEntity->createClassManipulator() at /project/path/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php:229 Symfony/Bundle/MakerBundle/Maker/MakeEntity->generate() at /project/path/vendor/symfony/maker-bundle/src/Command/MakerCommand.php:102 Symfony/Bundle/MakerBundle/Command/MakerCommand->execute() at /project/path/vendor/symfony/console/Command/Command.php:326 Symfony/Component/Console/Command/Command->run() at /project/path/vendor/symfony/console/Application.php:1096 Symfony/Component/Console/Application->doRunCommand() at /project/path/vendor/symfony/framework-bundle/Console/Application.php:126 Symfony/Bundle/FrameworkBundle/Console/Application->doRunCommand() at /project/path/vendor/symfony/console/Application.php:324 Symfony/Component/Console/Application->doRun() at /project/path/vendor/symfony/framework-bundle/Console/Application.php:80 Symfony/Bundle/FrameworkBundle/Console/Application->doRun() at /project/path/vendor/symfony/console/Application.php:175 Symfony/Component/Console/Application->run() at /project/path/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 Symfony/Component/Runtime/Runner/Symfony/ConsoleApplicationRunner->run() at /project/path/vendor/autoload_runtime.php:29 require_once() at /project/path/bin/console:15make:entity [-a|--api-resource] [-b|--broadcast] [--regenerate] [--overwrite] [--with-uuid] [--with-ulid] [--] [<name>]
The text was updated successfully, but these errors were encountered:
Description
It is not possible to create an entity named “Attribute” using the maker bundle.
A message indicating that the entity exists appears when running the make:entity command.
Followed by an error:
In FileManager.php line 111:
Warning: file_get_contents(/project/path/): Failed to open stream: No such file or directory
How to reproduce
Create a Symfony project (version 6.4 and above):
symfony new test_project --version=6.4 cd ./test_project/
Install the ORM pack and the maker bundle:
Attempt to create the "Attribute" entity:
The console will return an output like this:
Possible Solution
The issue seems to come from line 191 of the
Generator
class in the maker bundle:This check verifies if the entered class already exists, but not using namespacePrefix value.
However, since PHP 8, the
Attribute
class exists for managing class attributes (vs annotations).The check should be modified to verify that the class exists in the namespace.
What do you think?
Additional Context
Here is the output of the
make:entity
command in verbose mode.The text was updated successfully, but these errors were encountered: