Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I used to have <code>findDependentRowset</code> on my systems. But not anymore! It's a waste of resources in most cases. Table joins should be on your SQL statement.</p> <p>See my answer here: <a href="https://stackoverflow.com/questions/4433910/hand-made-queries-vs-finddependentrowset/4435539#4435539">Hand made queries vs findDependentRowset</a></p> <p><s>I'm still far away from use Doctrine or Propel (I've never needed it). Maybe some day.</s> (Now using <strong>Doctrine 2</strong>. So... I suggest you the same now)</p> <hr /> <h3>OLD ANSWER</h3> <p>After a couple of years working with Zend Framework, I come across with the following architecture:</p> <p>1) I have an abstract mapper which all my mappers extends: <code>Zf_Model_DbTable_Mapper</code></p> <p>2) I have an abstract model (domain object) too, similar to the Row Data Gateway, with the exception that it is not a gateway. It's a generic domain object: <code>Zf_Model</code></p> <p>3) When populating object graphs (SQL joins) one mapper delegates to the other mappers that are responsible for the given object.</p> <p><strong>Example</strong></p> <p>This method is from the abstract mapper:</p> <pre><code> public function getById($id) { $tableGateway = $this-&gt;getTable(); $row = $tableGateway-&gt;fetchRow('id =' . (int) $id); if (!$row) retur null; $row = $row-&gt;toArray(); $objectName = $this-&gt;getDomainObjectName(); $object = new $objectName($row['id']); $object-&gt;populate($row); return $object; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload