Re: Only check beforeDelete if direct deletion

2013-02-19 Thread david . suna
On Monday, February 18, 2013 12:27:46 AM UTC+2, cricket wrote: > > > Perhaps you need to re-think your schema. What is the purpose of Record? > > Also, why do you wish to cancel a Record delete if an Invoice exists? > I abstracted the specific problem domain in the hopes of not getting lost in

Re: Only check beforeDelete if direct deletion

2013-02-17 Thread lowpass
On Sun, Feb 17, 2013 at 1:33 PM, wrote: > Unfortunately, that won't work since an Invoice does not always have a > Record. I still need to be able to get all of the Invoices for a Tenant > even if there is no Record associated with the Invoice. Similarly, there > can be Records that are not ref

Re: Only check beforeDelete if direct deletion

2013-02-17 Thread david . suna
Unfortunately, that won't work since an Invoice does not always have a Record. I still need to be able to get all of the Invoices for a Tenant even if there is no Record associated with the Invoice. Similarly, there can be Records that are not referenced by an Invoice. -- Like Us on FaceBook

Re: Only check beforeDelete if direct deletion

2013-02-17 Thread lowpass
On Sun, Feb 17, 2013 at 9:27 AM, wrote: > > Tenant hasMany Invoices (dependent => true) Remove the direct association between Tenant and Invoice and access the latter through Tenant->Record->Invoice. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/

Only check beforeDelete if direct deletion

2013-02-17 Thread david . suna
I have an application built with CakePHP 1.3 with a model structure as follows: Tenant hasMany Records (dependent => true) Tenant hasMany Invoices (dependent => true) An Invoice can have a reference to a Record which I represent as Invoices belongsTo Records so that fetching an Invoice will fetch