cwbit / cakephp-aggregate-cache

A Behavior plugin for CakePHP that extends the idea of counterCache and counterScope to more fields
8 stars 4 forks source link

check that the associated record exists before saving #10

Closed Indemnity83 closed 10 years ago

Indemnity83 commented 10 years ago

The behavior doesn't check that the associated model exists before calling save(). This can, in certain circumstances, cause the behavior to create errant records in the database which is likely not desirable.

The proposed change simply checks that the associated model exists before issuing the save. If the model does not exist then it silently doesn't do anything (whether it should throw an error is up for debate).