1

I use this synthax to get a property from dependent table on my view template:

<?php echo $row->findParentRow('Apimail_Model_DbTable_Campagne')->title ?>

It's work but I want to know if it's the good way to do this.
Is it possible to do it more simple like this ?

<?php echo $row->Campagne->title ?> //Where Campagne is my rules in referenceMap
Florent
  • 12,310
  • 10
  • 49
  • 58
user1697015
  • 61
  • 1
  • 4

1 Answers1

0

Yes it's working and you could keep it without anything else. But maybe you want to make it more "dev friendly". There are several solutions to mask your data tables relations :

  • You can use Table Data Gateway, extending Zend_Db_Table_Abstract. Here is a good beginner guide from Rob Allen (see 'The Model' section). It's also the chosen way in the ZF reference guide.
  • You can choose the 'Mapper' way. Here is the quickstart guide from ZF website (be careful it's interresting only for Application_Model_Guestbook and Application_Model_GuestbookMapper classes and the rest is very confusing imo. Be careful with it)
  • You could also choose to use Table Data Gateway PLUS extending Zend_Db_Table_Row. This is my preferred solution. You'll find more help on Stackoverflow, especially on this page. I think you will prefer this solution.
  • Finally, you could choose to use an external ORM, like Doctrine. Some help to use Doctrine with ZF here and here (in french, I think you won't mind :) ) or here in english
Community
  • 1
  • 1
LittleBigDev
  • 454
  • 4
  • 23