I want to see one table across the symfony2 Bundle

Asked 1 years ago, Updated 1 years ago, 83 views

Thank you for your help.I'm studying PHP and symfony.

  • Parent/AdminBundle/
  • Parent/UserBundle/

There are two bundles.
There are three tables:(It has already been created and contains data.)

  • admin
  • user
  • product

I would like to refer to the product from AdminBundle and UserBundle.
I was wondering if I should create Entity under Parent, so I defined the yml file and tried generating it.

$sudophp app/console doctorline:generate:entities Parents
Generating entries for namespace "Parents"

  RuntimeException                                            
  Namespace "Parents" does not contain any mapped entries.  

Failed to create Entity due to the error:
How can I resolve this?

php symfony2

2022-09-30 17:35

2 Answers

Although it is technically the same as Issei.M's answer, I will supplement the content.

Although the structure of a bundle of Symfony is a unit of software package, there is no restriction on the use across packages when multiple bundles are utilized within a single application.Any bundle class is available from anywhere (because autoloading works).

However, it is difficult to have unlimited entities scattered here and there, so it is usually managed as much as possible so that the dependency direction of the package is one direction.As Issei.M replied, putting together a common use of CoreBundle is like one way to do that.


2022-09-30 17:35

誤り There was an error, so I corrected it.

By creating a common bundle like CoreBundle and putting Entity together there, I think you can achieve what you want to do.


2022-09-30 17:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.