If you are trying to do conditions as part of the delete command, you need deleteAll which accepts an array of conditions in the first parameter Otherwise do the test before you move on to the delete command. Think of delete as deleteById only.
On Dec 17, 10:25 am, Daniel <[email protected]> wrote: > I have an image table that is related to a gallery table via a > gallery_id field. There is a user_id field on the gallery table. In > the delete function in the image_controller I want to test whether the > user has authorisation to delete the image, by fetching the user_id > from the gallery table and comparing it to the logged on user. How in > the delete function do I reference the user_id? I've tried alsorts of > ways including actually fetching the related gallery record with the > find method, none seem to work for me. > > I tried setting the recursive variable within the delete function. I > tried using $this->data['Gallery']['user_id'] and also > $this->Image->Gallery('user_id') but both gave an error: > > Warning (512): SQL Error: 1054: Unknown column 'Image.user_id' in > 'field list' [CORE\cake\libs\model\datasources\dbo_source.php, line > 684] > > Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
