Skip to content

Commit

Permalink
Merge pull request #2 from ScullWM/swm-version
Browse files Browse the repository at this point in the history
Swm version
  • Loading branch information
ruckuus committed Jul 11, 2013
2 parents f6d4731 + c0b2838 commit a87f8fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ use Ruckuus\Silex\ActiveRecordServiceProvider;

$app = new Application();


$app->register(new ActiveRecordServiceProvider(), array(
'ar.model_dir' = __DIR__ . '/App/Model';
'ar.connections' = array (
'development' => 'mysql://root@localhost/database_name'
);
'ar.default_connection' = 'development';
'ar.model_dir' => __DIR__ . '/App/Model',
'ar.connections' => array ('development' => 'mysql://root@localhost/database_name'),
'ar.default_connection' => 'development',
));

```
Expand Down
17 changes: 3 additions & 14 deletions src/Ruckuus/Silex/ActiveRecordServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,19 @@

class ActiveRecordServiceProvider implements ServiceProviderInterface
{
private $app;

public function register(Application $app)
{
function register(Application $app){
$this->app = $app;

$app['ar.model_dir'] = $app['base_dir'] . '/App/Model';
$app['ar.connections'] = array(
'development' => 'mysql://root:password@localhost/database_name'
);
$app['default_connection'] = 'development';

$app['ar.init'] = $app->share(function (Application $app) {
\ActiveRecord\Config::initialize(function ($cfg) use ($app) {
$cfg->set_model_directory($app['ar.model_dir']);
$cfg->set_connections($app['ar.connections']);
$cfg->set_default_connection($app['ar.default_connection']);
});
});

});
}

public function boot(Application $app)
{
function boot(Application $app){
$this->app['ar.init'];
}
}

0 comments on commit a87f8fe

Please sign in to comment.