Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MOHAMMED-BE opened this issue Oct 4, 2024 · 2 comments
Labels
Bug Bug Fix Status: Needs Review Needs to be reviewed

Comments

@MOHAMMED-BE
Copy link

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

@MOHAMMED-BE MOHAMMED-BE added the Bug Bug Fix label Oct 4, 2024
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Oct 4, 2024
@xabbuh xabbuh transferred this issue from symfony/symfony Oct 4, 2024
@issamkhadiri1989
Copy link

Hello @MOHAMMED-BE

Thank you for the report. Can you give us further details about your environment please ? I could not reproduce the bug following the steps you described.

This issue is probably only related to Windows using some software (xamp wamp...)

carbon (7)

Here you can see that the make command could create the entity without any issues

Also, i could edit the existing entity

carbon (8)

The maker bundle's version is v1.61.0

NOTE : I created a project using the composer command :

composer create-project symfony/skeleton:"6.4.*" my_project
cd my_project
composer require webapp

By the way, I am using Docker. Sometimes, I had this kind of issues, but a restart of containers solved the issue. Did you try this ?

@MOHAMMED-BE
Copy link
Author

Hello @issamkhadiri1989

Thank you for your comment.
I'm using wamp with PHP 8.1. I didn't try to use docker, but I try to create a new project on four different devices using composer and symfony-cli, with different localhost environments (xampp, wamp), and I had the same issue.

I'll try it on the Linux environment and see.

NOTE: I have the same project with 6.4.3, 6.2, and it's works correctly .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Needs Review Needs to be reviewed
Projects
None yet
Development

No branches or pull requests

3 participants