Created
December 12, 2012 14:51
-
-
Save mattkirwan/4268336 to your computer and use it in GitHub Desktop.
ServiceProvider DB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Service Provider | |
$app->register(new Via\Content\ContentServiceProvider()); | |
// Route | |
$app->get('/{id}', function(Doctrine\DBAL\Connection $db) use ($app) { | |
return $app['content.id_checker']($db); | |
}); | |
// and in .... ContentServiceProvider | |
public function register(Application $app) | |
{ | |
$app['content.id_checker'] = $app->protect(function ($db) use ($app) { | |
return new IdChecker($db); | |
}); | |
}; | |
// IdChecker() instantiates...method check($id) | |
public function check($id) | |
{ | |
// Check against $db and return boolean. | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment