milesj / utility

[Deprecated] A CakePHP plugin for common utility classes.
MIT License
69 stars 24 forks source link

Fix for storyEmpty and forceRefresh #18

Closed Ali1 closed 10 years ago

Ali1 commented 10 years ago

storyEmpty: if(!$results) is not adequate to detect empty arrays forceRefresh: not sure if you like this implementation which allows future options you may want to add.

milesj commented 10 years ago

Not sure I agree with your null/false conditional changes. !$array is more than adequate to check for non-empty arrays. There's even tests for it: https://github.com/titon/titon/blob/master/tests/titon/ExprBenchmarkTest.php#L151

Ali1 commented 10 years ago

I agree !$array is adequate for non-empty arrays. The reason for the change is if one uses storeEmpty, then there is a chance that $results will be an empty array and this should be considered as a successful cache retrieval. var_dump((bool) array()); // bool(false)

Ali1 commented 10 years ago

Hi. The latest commit is a separate issue. After some tests on CakePHP 2.4.3, it seem that a false return on the Behaviour afterSave stop the model afterSave from being called. Strange.

milesj commented 10 years ago

Forgot about this. Merged.