title: CakePHP database how it works?
body: <p>I have 3 tables: users, images (foreign key to user_id), comments (foreign keys: user_id and image_id)</p>
  
  <p>Can somebody explain me or send me link to good tutorial how to work with database?
  I mean e.g.:
  1. I wants to take all Images which have any comment in Comments table. In SQL: select i from Images i, Commets c where i.id=c.image_id???</p>
  
  <p>Can You explain me how can I access from one controller to another Model?
  I was trying in Images controller: 
  $data = $this->Image->query('Select * from Images i, Comments c where i.id=c.image_id');
  And in view: $image['id'] but I have error:Undefined index: id [APP\views\images\commented.ctp,</p>
  
  <p>SO it does not work:/</p>
  
  <ol>
  <li>How can I delete Image and all its comments? I used Zend and I get used to it and I have no idea how to do the same thinks in cakePHP :/</li>
  </ol>
  
  <p>Can somebody explain me how to work with database in this cakePHP I know there are find, findAll etc functions but all of them are from a controller level ex. $this->Image->find() etc... </p>
  
  <p>I need better tutorial than the basic cakePHP cookbook :/. I am open for any sugestions.
  Regards,</p>