Re: associated models fieldnames - findAll()
Very thank You for the answer. The query you had in the middle of your post that strangely works is not so strange - you are querying the Photo table, so of course you can use Photo conditions. I meant, that in this way I can use conditions on both Models - this on example should be more correct: $this-Realization-Photo-findAll('Photo.id = 59 and Realization.id = 1') will be ok but $this-Realization-findAll('Photo.id = 59 and Realization.id = 1') this one not What I actually want is to force it to make INNER JOIN as it does it in the first case - what as I guess should be provided when I use $this-Realization-recursive = 2. So is the only way to do this Inner Join Model-query() method ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
associated models fieldnames - findAll()
Hi, I'm having problem with fieldnames from associated models in findAll(). I saw it quite common for others. The result from $this-Realization-findAll() - as below - shows that associations works ok, BUT when try to condition on Photo it is wrong e.g. $this-Realization-findAll('Photo.id = 59') cause SQL Error: 1054: Unknown column 'Photo.id' in 'where clause' [0] = Array ( [Realization] = Array ( [id] = 1 [title] = liceum_sztuk_plastycznych ) [Photo] = Array ( [0] = Array ( [id] = 59 [realization_id] = 1 ) [1] = Array ( [id] = 58 [realization_id] = 1 ) What is strange $this-Realization-Photo-findAll('Photo.id = 59') will work ok. It is strictly connected with : http://groups.google.pl/group/cake-php/browse_thread/thread/dcbb867063e4696c/4fbbbd0bf6223330?tvc=2q=findAll#4fbbbd0bf6223330 My models code : Ralization.php ?php class Realization extends AppModel { var $name=Realization; var $hasMany = array('Photo'); } ? and Photo.php ?php class Photo extends AppModel { var $name=Photo; var $belongsTo = 'Realization'; } ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
download doc file with cake
Cake puts some characters which destroy .doc structure when downloading. Here is an analogic function which works ok in plain php script function download_doc_file($id = null) { $this-autoRender = false; $file = APP.rtf/.$id./cv.doc; $basename = basename($file); $file_extension = strtolower(substr(strrchr($basename,.), 1)); if (!file_exists($file)) { print ERROR: File not found. $basename; exit; } else { switch($file_extension) { case PLS: $ctype=audio/x-scpls; break; case pls: $ctype=audio/x-scpls; break; case pdf: $ctype=application/pdf; break; case exe: $ctype=application/octet-stream; break; case zip: $ctype=application/zip; break; case doc: $ctype=application/msword; break; case xls: $ctype=application/vnd.ms-excel; break; case ppt: $ctype=application/vnd.ms- powerpoint;break; case gif: $ctype=image/gif; break; case png: $ctype=image/png; break; case jpeg: case jpg: $ctype=image/jpg; break; default: $ctype=application/force-download; } header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Cache-Control: private,false); // required for certain browsers header(Content-Type: $ctype); header(Content-Disposition: attachment; filename= \$basename\; ); header(Content-Transfer-Encoding: binary); readfile($file); exit(); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
scaffold Component : Scaffold::__scaffold
I try to use this method in my controller. Probably I have some syntax error. Can anyone help, please ? : ?php uses('controller/scaffold'); class RealizationsController extends AppController { var $layout = 'default'; var $name = 'Realizations'; var $scaffold; function add() { Scaffold::__scaffold(array('action' = 'add')); } } ? then I get errors: Notice (8): Undefined property: RealizationsController:: $ScaffoldModel Notice (8): Trying to get property of non-object [CORE/cake/libs/ controller/scaffold.php, line 404] Fatal error: ConnectionManager::getDataSource - Non-existent data source in /opt/lampp/htdocs/cake/cake/libs/model/ connection_manager.php on line 110 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---