title: CakePHP - HABTM - sending data from multiple tables to a view
body: <p><strong>Scenario:</strong></p>
  
  <pre><code>3 tables:
  restaurants
  cuisines
  features
  
  2 join tables:
  cuisines_restaurants
  features_restaurants
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>What is the best way to get data for a single restaurant from my controller to the view which includes not only the restaurant data, but also the cuisines and features that it has.</p>
  
  <p>I have it working with this:</p>
  
  <pre><code>$restaurant = $this-&gt;Restaurant-&gt;find('all', array('conditions' =&gt; array('Restaurant.id' =&gt; $id)));
  $this-&gt;set('restaurant', $restaurant);
  </code></pre>
  
  <p>And I'm calling it in the view like this:</p>
  
  <pre><code>echo "&lt;span class='label'&gt;Name:&lt;/span&gt; " . $restaurant[0]['Restaurant']['name'] . "&lt;br /&gt;";
  echo "&lt;span class='label'&gt;Cuisine:&lt;/span&gt; ";
      $cuisineList = "";
      foreach($restaurant[0]['Cuisine'] as $cuisine) {
          $cuisineList .= $cuisine['name'] . ", ";
      }
      echo substr($cuisineList,0,-2) . "&lt;br /&gt;";
  </code></pre>
  
  <p>(and repeat for Features)</p>
  
  <p>But this seems overkill, since in all the Cake tutorials I see, the view method in the controller just has:</p>
  
  <pre><code>$this-&gt;set('restaurant', $this-&gt;Restaurant-&gt;read(null, $id));
  </code></pre>
  
  <p>Then they call it like this:</p>
  
  <pre><code>echo $restaurant['Restaurant']['name'];
  ...etc
  </code></pre>
  
  <p><strong>Again - it IS working - I just want to know if there's a better way - the way I'm currently doing it seems sloppy compared to all the other slick things Cake does for me! :)</strong></p>