0

Is there any way in symfony that "Entity less repositories" be used in services just like one service is calling another service.

I am asking because I want put sql DQL/SQL in methods separated from Services like in 2 layers as I don't want to map any table with entity.

Services >> Repositories >> Db

Twitter Service >> TwitterRepository >> Table1, tabl2, tabl3, table4, tabl5 Db

for example I can replace Twitter in following call

$data = $this->getEntityManager()->getRepository->("MyApiBundle:SocialMedia\Twitter")->findProfileTweets($profileId)

in short 1. Repository can be called in service. 2. Entity should not be used.

any help we be appreciated. Thanks in advance .

ajay_full_stack
  • 494
  • 7
  • 13
  • Do you still want to use the Doctrine repository class? If so then define it as a service and inject it. – Cerad Sep 25 '17 at 18:34
  • @Cerad, Can you please suggest how to define it in service.yml and how to inject it in service. as I guess entity name still required in service.yml – ajay_full_stack Sep 25 '17 at 19:46
  • The accepted answer here might help: https://stackoverflow.com/questions/46415177/how-can-i-add-get-container-in-form-builder-symfony Still not clear if this is actually what you want. – Cerad Sep 26 '17 at 12:49

0 Answers0