I am stuck with a problem please help me with it. Here is the scenarario:
I have an entity \"User\" and corresponding repository \"UserRepository\", inside my entit
Everything is possible however you should not access the entity's repository from the entity itself because of the separation of concerns.
See this Stackoverflow answer for more details.
Basically, the whole idea is that you want to have your application organized the following way.
In short:
It should not go in the other direction otherwise it creates a mess.
If you want to go a bit further into the separation of concerns you could do the following.
Alternative solutions:
There are probably others but you would know better how your application is organized.