php - Data Gateway Pattern and Foreign Keys -


how 2 concepts work ?

i have scenario

  • city table
  • country table
  • city.country_id fk country.id

    objective

  • fetch cities , display country name also

    my problem

  • fetch method cities table
  • if need country name have search or inner join doing make queries when not necessary (display city info example)

    question

  • what right way apply data gateway pattern in case.

  • you should use join if need h associated country name. add method fetchwithcountry.


    Comments

    Popular posts from this blog

    apache - Add omitted ? to URLs -

    redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

    php - How can I stop spam on my custom forum/blog? -