Re: Is there a standard way of making sure that foreign keys exist?

2011-02-24 Thread Joshua Muheim
Oops, my bad, wrong behavior (although the mentioned one is quite useful, too). Here's the correct one: Automatically verify foreign keys in CakePHP: http://josh.ch/wordpress/?p=63 On Thu, Feb 24, 2011 at 5:33 PM, Joshua Muheim wrote: > I have added this behavior to my Subversion repository and

Re: Is there a standard way of making sure that foreign keys exist?

2011-02-24 Thread Joshua Muheim
I have added this behavior to my Subversion repository and created a small blog article about it... I hope someone finds this useful. Automatically prevent records with depending children from being deleted: http://josh.ch/wordpress/?p=80 On Fri, Nov 5, 2010 at 9:46 AM, Joshua Muheim wrote: > It

Re: Is there a standard way of making sure that foreign keys exist?

2010-11-05 Thread Joshua Muheim
It's done. :-) orphansProtectableOptions = array_merge(array( ), $settings); } /** * ??? */ function beforeValidate(&$Model) { $valid = true; foreach($Model->belongsTo as $model => $settings) { $foreignKey = $settings['foreignKey']; $foreignKeyValue = $Model->d

Re: Is there a standard way of making sure that foreign keys exist?

2010-11-04 Thread cricket
On Thu, Nov 4, 2010 at 5:57 AM, psybear83 wrote: > Hi everybody > > Before creating a behavior myself I wanted to ask this (see title). > > I only found this: > http://ask.cakephp.org/questions/view/how_to_check_the_validness_of_a_foreign-key_must_contained_in_primary-key_list > > ...but there's n

Is there a standard way of making sure that foreign keys exist?

2010-11-04 Thread psybear83
Hi everybody Before creating a behavior myself I wanted to ask this (see title). I only found this: http://ask.cakephp.org/questions/view/how_to_check_the_validness_of_a_foreign-key_must_contained_in_primary-key_list ...but there's no solution for the problem. If nothing like this exists yet, I