Just to bump it up, here's an update on my troubles:
-- I've decided to create a few basic methods on the Order model.
Order::fetch(); //only fetches the Order data, without calculation
Order::stage(); //fetches data and runs all data Modifier callbacks (through Behaviors), doesn't save the data to DB.
Order::commit(); //runs stage() modifiers and commits data to DB
By Modifiers, I am referring to multiple custom Behaviors, which can be turned on and off as needed.
For instance, I've packed Shippable, Vatable, VatDeductible, Discountable behaviors, all of which can modify the find query, related model bindings and Order | OrderItems | Payment | Fullfillment data, but the Order and OrderItem models are always in charge of calculating, validating and storing the data.
I've also created some new Order::implementedEvents (beforeFetch, beforeStage, beforeCommit, afterFetch, etc.. ) which run on the Order object and all it's attached behaviors.
This is really one of the fattest models I've made and I am having trouble wrapping my head around these callbacks and their expected use.
I would really appreciate some insight if I'm coding in a good direction and maybe a reference to a proper event-driven, fat model project??
if ($Post->is('vague')) { Sorry::because( "I forgot how to human" ) ;}
I would really appreciate some insight if I'm coding in a good direction and maybe a reference to a proper event-driven, fat model project??
if ($Post->is('vague')) { Sorry::because( "I forgot how to human" ) ;}
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment