Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • In you example you have to ask 2 times . $mapper = new Music_Model_Mapper_Track(); $tracks = $mapper->findByColumn('album_id', $this->id, 'track ASC'); So I want to ommit asking 2 only one time DB with join query Commented Nov 8, 2012 at 19:55
  • I do it that in this example because I rarely need that particular data set. So it is set up to be available if needed. However if you need the data in your entity available all the time build a join. The info will also be avialble if I use something like $result->album->artist so the info is always available, it just lazy loads. Commented Nov 9, 2012 at 9:10
  • $mapper = new Music_Model_Mapper_Track(); this is the database adapter (my connection to mysql).$mapper->findByColumn('album_id', $this->id, 'track ASC'); this is the database query. This is an aliased fetchRow() method that returns an entity object. Commented Nov 9, 2012 at 9:17
  • if you are performing queries in your entity models, your data structure could probably use some refactoring. Commented Nov 9, 2012 at 9:19