Hello,

In an example, i want to delete a location if no rooms are associated
to this location.
I tryed the following:

[code]
function delete($id)
        {
    if(empty($this->Room->find('all', 'fields' =>
array('Room.location_id'))))
    {
                  $this->Location->del($id);
                  $this->Session->setFlash('Löschvorgang (id: '.$id.')
erfolgreich!');
                  $this->redirect(array ('action' => 'index'));
    }
    else
    {
      $this->Session->setFlash('Löschvorgang (id: '.$id.')
fehlgeschlagen, da noch Räume für dieses Gebäude existieren!');
                  $this->redirect(array ('action' => 'index'));
    }
        }
[/code]

Well, this dont works. I dont know how to correctly create the
"find" :/
Could someone help me please? Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to