Sohei: thank you! :) It took me 2 min. to find the problem, after I had
set the debug option to "2":

1 query took 1 ms Nr    Query   Error   Affected        Num. rows       Took 
(ms)
1       SELECT `File`.`id`, `File`.`name`, `File`.`type`, `File`.`size`,
`File`.`data`, `File`.`created`, `File`.`modified` FROM `files` AS
`File` WHERE (`File`.`id` = 2) LIMIT 1          1       1       1
HTTP/1.1 200 OK Date: Thu, 07 Sep 2006 21:01:19 GMT Server:
Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b
mod_autoindex_color PHP/5.1.4 X-Powered-By: PHP/5.1.4 Content-Length:
1314 Keep-Alive: timeout=5, max=96 Connection: Keep-Alive Content-Type:
text/html
Warning: Invalid argument supplied for foreach() in D:\download\1 -
nyttige programmer\1 -
Internet\development\xampp\htdocs\cake\cake\libs\model\model_php5.php
on line 1019

Warning: Cannot modify header information - headers already sent by
(output started at D:\download\1 - nyttige programmer\1 -
Internet\development\xampp\htdocs\cake\cake\libs\model\model_php5.php:1019)
in D:\download\1 - nyttige programmer\1 -
Internet\development\xampp\htdocs\cake\cake\libs\controller\controller.php
on line 401
2 queries took 0 ms Nr  Query   Error   Affected        Num. rows       Took 
(ms)
1       DELETE FROM `ccases_pictures` WHERE `id` = '2'          1               0
2       SELECT `File`.`id` FROM `files` AS `File` WHERE
`File`.`ccases_picture_id` = '2'        1054: Unknown column
'File.ccases_picture_id' in 'where clause'

The File table does not have a ccases_picture_id field. I solved the
problem by setting foreign key in the CcasesPictures model:


class CcasesPicture extends AppModel
{
        var $name = 'CcasesPicture';

        //The Associations below have been created with all possible keys,
those that are not needed can be removed
        var $hasOne = array(
                        'File' =>
                         array('className' => 'File',
                                        'conditions' => '',
                                        'order' => '',
                                        'foreignKey' => 'id', // <-- RIGHT HERE
                                        'dependent' => true),

        );

}


Best regards.
Asbjørn Morell.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to