Skip to content

Commit

Permalink
Define model provider with ActiveRecord\ModelProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 7, 2016
1 parent f4bc941 commit 45e5186
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ static public function synthesize_models_config(array $fragments)
*/

/**
* Patches the `get_model()` helper to use the model collection bound to the application.
* Define model provider.
*
* Models are provided using the model collection bound to the application.
*
* @param Core\BootEvent $event
* @param Core|CoreBindings $app
*/
static public function on_core_boot(Core\BootEvent $event, Core $app)
{
ActiveRecord\Helpers::patch('get_model', function($id) use ($app) {
ActiveRecord\ModelProvider::define(function($id) use ($app) {

return $app->models[$id];

Expand Down

0 comments on commit 45e5186

Please sign in to comment.