Puh, das ne gute frage..
Das mit der HABTM hab ich auch noch nicht so ganz gecheckt.
Glaub muss mir das mal in aller ruhe nicht in "ich guggs mal schnell durch" durchlesen.
Empfehlungen: Erweiterte Suche
<?php
class Artist extends AppModel {</p>
<p> var $name = 'Artist';
var $useTable = 'artists';
var $validate = array(
'name' => VALID_NOT_EMPTY
);</p>
<p> //The Associations below have been created with all possible keys, those that are not needed can be removed
var $hasAndBelongsToMany = array(
'Event' => array('className' => 'Event',
'joinTable' => 'artists_events',
'foreignKey' => 'artist_id',
'associationForeignKey' => 'event_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);</p>
<p>}
?><?php
class Event extends AppModel {</p>
<p> var $name = 'Event';
var $useTable = 'events';
var $validate = array(
'name' => VALID_NOT_EMPTY,
'date' => VALID_NOT_EMPTY,
'location' => VALID_NOT_EMPTY,
'flyerpreview' => VALID_NOT_EMPTY,
'flyer' => VALID_NOT_EMPTY);</p>
<p> //The Associations below have been created with all possible keys, those that are not needed can be removed
var $hasAndBelongsToMany = array(
'Artist' => array('className' => 'Artist',
'joinTable' => 'artists_events',
'foreignKey' => 'event_id',
'associationForeignKey' => 'artist_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);</p>
<p>}
?>CREATE TABLE `members` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`forename` varchar(64) DEFAULT NULL,
`name` varchar(64) DEFAULT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8CREATE TABLE `partnerships` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast