These are the Models and the corresponding SQL-Structure:

class VsArticle extends AppModel {

        var $name = 'VsArticle';

        var $actsAs = array("Containable");

        var $displayField = "title";
        var $order = "VsArticle.title";

        var $belongsTo = array("VsShop" => array("exclusive" => true),
"VsMake" => array("exclusive" => true));
        var $hasAndBelongsToMany = array("VsCategory" => array(
                "className" => "VsCategory",
                "joinTable" => "vs_article_has_vs_category",
                "unique" => true,
                "exclusive" => true
        ));
}

id                                      bigint(20)
status                          varchar(45)
artnr                           varchar(255)
title                           varchar(255)
price                           float
img_url                         varchar(1024)
imglarge_url            varchar(1024)
deeplink                        varchar(1024)
descr                           text
descr_short                     text
gender                          int(11)
created                         datetime
modified                        datetime
vs_make_id                      int(11)
vs_shop_id                      int(11)
original_category       varchar(255)
original_make           varchar(255)




class VsArticleHasVsCategory extends AppModel {
        var $name = 'VsArticleHasVsCategory';
        var $useTable = "vs_article_has_vs_category";
}

id                      bigint(20)
vs_article_id   bigint(20)
vs_category_id  int(11)
vs_shop_id      int(11)
hash                    varchar(255)




Did you see the mixed up Query?

DELETE `VsArticleHasVsCategory` FROM
`vs_article_has_vs_category` AS `VsArticleHasVsCategory` WHERE
`VsArticle`.`artnr` = '51715236-2-6-3-38-242' AND
`VsArticle`.`vs_shop_id` = 141

The whole query makes no sense at all: it is deleting from the Table/
Model "VsArticleHasVsCategory" (which is correct) but is referring to
the Table/Model "VsArticle" in the WHERE-statement.
And the WHERE-statement corresponds to the first model-find-statement
in the function:

'conditions' => array(
                'VsArticle.artnr' => $this->data["VsArticle"]
["artnr"],
                'VsArticle.vs_shop_id' => $shopId
)


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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to