metaclass-nl / filter-bundle

Filter bundle for API Platform, Filter Logic
MIT License
50 stars 9 forks source link

TestEntity is in the Database #5

Closed art-cg closed 2 years ago

art-cg commented 2 years ago

Hi.

The Table "test_entity" https://github.com/metaclass-nl/filter-bundle/blob/master/src/Entity/TestEntity.php exists in the database of the App of the users. And i get 2 warnings of the invalid mapping (Entities Mapping). The Other Table "test_related" is not in my database. I am not sure why.

Metaclass\FilterBundle\Entity\TestEntity | The  association Metaclass\FilterBundle\Entity\TestEntity#toOneNullable  refers to the inverse side field  Metaclass\FilterBundle\Entity\TestRelated#toMany which does not exist.                                                                                     The  association Metaclass\FilterBundle\Entity\TestEntity#toMany refers to  the owning side field Metaclass\FilterBundle\Entity\TestRelated#project  which does not exist.
-- | --
Metaclass\FilterBundle\Entity\TestRelated | The  mappings Metaclass\FilterBundle\Entity\TestRelated#testEntity and  Metaclass\FilterBundle\Entity\TestEntity#toMany are inconsistent with  each other.

Possible ideas für solutions:

metaclass-nl commented 2 years ago

Thanks for reporting this problem. You are right, test entities from a bundle should not impact the database of App. As you suggested I moved the filter0bundle/src/Entity folder to tests so that Doctrine will not find it automatically. This should solve it becuase there should be no configuration in normal apps to make Doctrine include the files to run the tests.

For running the th tests I adapted the config in metaclass-nl/test-filter-bundle.

art-cg commented 2 years ago

Thank you