AFAIK, cake doesn't have this built in, however if you use InnoDB mysql tables you can use Foreign Key Constraints, which should give you what you want. http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
On Aug 23, 8:30 pm, rvandervort <[email protected]> wrote: > Sorry that should read " 'Player' => array( 'Player' => > 'Player' " > > On Aug 23, 9:15 pm, rvandervort <[email protected]> wrote: > > > > > I'm not sure why, but expected models related by belongsTo and hasMany > > to be "autovalidated". > > > e.g. > > > class Team extends AppModel { > > var $hasMany = array( > > 'Player' => array( 'Player' => 'Item' , 'foreignKey' => > > 'team_id' ) > > ); > > > } > > > class Player extends AppModel { > > var $belongsTo = array( > > 'Team' => array( 'className' => 'Team' , 'foreignKey' => > > 'team_id' ) > > ); > > > } > > > --- > > I thought for sure that an invalid team_id would be automatically > > validated, but this does not seem to be the case. > > > Question : Is there a built in rule that will validate the team_id > > when I insert a new Player record ? Or do I have to roll my own > > solution to this ? > > > Thanks, > > Roger 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
