Thursday 15 March 2012

php - Entities that are able to return own url -



php - Entities that are able to return own url -

i realize similar questions have been asked , answered, bear me because haven't found answers satisfactory in that, still don't see how solve problem. understand "you shouldn't that". fine, can help me understand how accomplish (seemingly) simple task?

i have number of entities (i utilize term loosely, these not doctrine entities, from-scratch info models load info external api). of these entities have geturl() function, anywhere encounter them, can phone call $entity->geturl() , have proper , consistent url use.

initially constructing these url paths hand, realized, "i should using urls defined in routing configuration generate these. guaranteed consistent site-wide". search , come across these answers on "your entities shouldn't know other entities" , "create separate service." well, fine, still want $entity->geturl() method call! impossible accomplish , still adhere basic principles? can explain me how can done? if create separate service, still don't seem able accomplish goal, since "you shouldn't access services within entities."

what's guy do? can help me understand?

php symfony2

No comments:

Post a Comment