rabota_ is prefix for table =) Can you take me an example of using DeleteAll?
2010/2/15 John Andersen <[email protected]> > Use the models deleteAll method! See the CakePHP book at: > http://book.cakephp.org/view/516/Deleting-Data#deleteAll-692 > > Note that your CREATE statement states that the HABTM table is named > "rabota_orgs_users" but your association definition in the Org model > mentions the table "orgs_users". Please check all your model names and > table names for inconsistencies! > > Enjoy, > John > > On Feb 14, 5:27 pm, Dark Neo <[email protected]> wrote: > > Hello, All! > > > > I have a problem. There are some tables in my project. Ex: Users and > > Orgs: > > > > CREATE TABLE IF NOT EXISTS `rabota_users` ( > > `id` int(11) NOT NULL auto_increment, > > `email` varchar(255) NOT NULL, > > `password` varchar(255) NOT NULL, > > `surname` varchar(255) NOT NULL, > > `name` varchar(255) NOT NULL, > > `birthdate` date default NULL, > > PRIMARY KEY (`id`), > > UNIQUE KEY `email` (`email`,`surname`,`name`) > > ) > > > > CREATE TABLE IF NOT EXISTS `rabota_orgs` ( > > `id` int(11) NOT NULL auto_increment, > > `email` varchar(255) NOT NULL, > > `password` varchar(255) NOT NULL, > > `title` varchar(255) NOT NULL, > > `exp_date` date default NULL, > > PRIMARY KEY (`id`), > > UNIQUE KEY `email` (`email`,`title`) > > ) > > > > And HABTM relationship between them: > > > > CREATE TABLE IF NOT EXISTS `rabota_orgs_users` ( > > `id` int(11) NOT NULL auto_increment, > > `org_id` int(11), > > `user_id` int(11), > > `post` varchar(255) NOT NULL > > PRIMARY KEY (`id`), > > ) > > > > In my CakePHP application I create relation: > > > > /models/org.php > > > > var $hasAndBelongsToMany = array( > > 'User' => array ( > > 'className' => 'User', > > 'joinTable' => 'orgs_users', > > 'foreignKey' => 'org_id', > > 'associatedForeignKey' => 'user_id' > > ) > > ); > > > > How to delete a record from orgs_users table where, for example, > > user_id = 1 and org_id = 2? > > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<cake-php%[email protected]>For > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- С уважением, Александр Бармин. Мой сайт: http://www.barmin-aleksandr.ru/ 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 [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?hl=en
