Skip to content

Error When Using make:entity to Create, Modify Existing Entities in Symfony 6.4.12 #1609

Open
@MOHAMMED-BE

Description

@MOHAMMED-BE

Symfony version(s) affected

6.4.12

Description

In Symfony 6.4.*, while creating new entities using the php bin/console make:entity command works as expected, attempting to create, modify an existing entity results in an error. Specifically, when running the command to create new entity, or add new fields to an entity that already exists, the following error occurs:

php bin/console make:entity Variant
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] [--] []

Screenshot 2024-10-03 110028

How to reproduce

To reproduce the problem, follow these steps:

1- Set Up a Symfony 6.4 Project

Ensure you have Symfony 6.4.* installed:
symfony new my_project --version=6.4 --webapp
cd my_project

2- Create an Entity or Modify an Existing One

Attempt to create or modify an entity named Attribute, Variant...:
php bin/console make:entity Variant

If Variant already exists, the maker should allow you to add new fields.

3- Encounter the Error

Instead of proceeding to add new fields, the following error is displayed:

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] [--] []

Possible Solution

Downgrade the Symfony Maker Bundle to an older, stable version where this issue does not occur. You can specify a known working version in your composer.json or use the following command:

composer require symfony/maker-bundle:^1.52

Additional Context

Screenshot 2024-10-03 110028

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions