Monday, August 5, 2013

Re: CakePHP: How to remove LEFT JOIN in updateAll()

Hi All,

You can change in function

class BriefcaseComponent extends Object{

        function delete($id){
                $names = array('deleted' => '0');
                $conditions = array("FilesFolders.instance_id" = '$id);
                $this->FilesFolders->updateAll($names, $conditions);
        }

}
?>


On Wednesday, 12 November 2008 13:27:10 UTC+5:30, Kryptonian wrote:
Hi, I have this problem that if my model uses a var $belongsTo = array
(), my updateAll() generated statement was affected with this error
message:

UPDATE `files_folders` AS `FilesFolders` LEFT JOIN `course_files` AS
`CourseFile` ON (`FilesFolders`.`account_id` = `CourseFile`.`id`) SET
`FilesFolders`.`deleted` = 0 WHERE `FilesFolders`.`instance_id` = '8′


My code:
<?php
class FilesFolders extends AppModel
{
        var $belongsTo = array(
           'CourseFile' => array(
               'className' => 'CourseFile',
               'foreignKey' => 'account_id'
           )
        );
}


class BriefcaseComponent extends Object{

        function delete($id){
                $names = array('deleted' => '0');
                $conditions = "FilesFolders.instance_id = '$id'";
                $this->controller->FilesFolders->updateAll($names, $conditions);
        }

}
?>


How can i remove the "LEFT JOIN" statement in my Update statement?

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: