RamyHakam / multi-tenancy-project-example

This is a simple example of using the https://github.com/RamyHakam/multi_tenancy_bundle
4 stars 3 forks source link

method "__construct()" has type "Hakam\Mu ltiTenancyBundle\Doctrine\ORM\TenantEntityManager" but this class was not found #9

Closed nronsisvalle closed 4 months ago

nronsisvalle commented 4 months ago

Hello @RamyHakam , first of all, thank you a lot for this bundle, it will solve a "problem" that i've always faced with symfony and now, with your bundle i'm finally starting to work on my first rest api multi-tenant project.

I'm very new with symfony, so please apologize if my question is not a real issue, but i spent some hours to understand what doesn't work in my setup with my setup and really don't know what's wrong.

I have symfony 7.1 with php 8.2. Installed your bundle version 2.7 (it should be the latest).

I've changed Main entiity from "Main" to "Admin"

Now, i copied Entities (Entity\Admin\TenantDbConfig.php, Entity\Admin\TenantUser.php, Entity\Tenant\Order.php, Tenant/StoreCategory.php), Repositories (Repository\Admin\TenantDbConfigRepository.php, Repository\Admin\TenantUserRepository.php, Repository\Tenant\OrderRepository.php, Repository\Tenant\StoreCategoryRepository.php) , and Controller (Controller\MultiTenantExampleController.php) from your example code to my setup, but when i try to run

php bin/console tenant:database:create

command, i got the following error:

Class 'TenantDb' does not exist Could you please point me in the right direction to understand and solve this issue?

Thank you a lot in advance

Best regards

RamyHakam commented 4 months ago

Hey, thanks for your words I think the issue could be with your doctrine configs in doctrine.yml file, please check if you set the default Entnity manager to default , you can check the example one in this repo

nronsisvalle commented 4 months ago

Hello @RamyHakam thank you a lot for your answer. In the meanwhile i was able to fix it (it was due to a permission problem on the apache container documentroot). Please apologize, i should have noticed you earlier.

Thank you again for this great bundle.