orm
orm copied to clipboard
💡 Throw an exception if entity repository attribute declared twice in different entities
I have an idea!
When developer declare a entity attribute like this: #[Cycle\Entity(repository: Repository\OfferHistory::class)]
for more than one entity I think what need to a thrown an exception for that case. Because if we can't do this, we got an unxpected behavior with application code and it may hard to debug.
One repository class can be used for a lot of enities. For example, default repository is universal class for all enitites.
I think it possible to make a schema checking on the application layer for this case, before Schema object initialization
Hmm. That true. May be is not a bad idea to allow using default repository for everyone but restrict if user use a custom repository.
We can discuss feature about new attribute to deny usage the same repository in more than one entity.