Created
February 24, 2015 10:53
-
-
Save davehewy/abf924b859e4d46247dd to your computer and use it in GitHub Desktop.
Eloquent and PHPmig (note this does not work)
This file contains 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
dave:~/sites/bin $ ./phpmig status | |
PHP Fatal error: Call to a member function schema() on boolean in /Users/davidheward/sites/vendor/davedevelopment/phpmig/src/Phpmig/Adapter/Illuminate/Database.php on line 89 | |
Fatal error: Call to a member function schema() on boolean in /Users/davidheward/sites/vendor/davedevelopment/phpmig/src/Phpmig/Adapter/Illuminate/Database.php on line 89 |
This file contains 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 | |
require '../game/http/includes/config.php'; | |
use \Phpmig\Pimple\Pimple, | |
\Phpmig\Adapter, | |
\Illuminate\Database\Capsule\Manager as Capsule; | |
$container = new Pimple(); | |
$container['config'] = array( | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'database' => 'migration_test', | |
'username' => 'root', | |
'password' => '', | |
'charset' => 'utf8', | |
'collation' => 'utf8_unicode_ci', | |
'prefix' => '' | |
); | |
$container['db'] = $container->share(function($c) { | |
$dbh = new PDO("mysql:host=" . $c['config']['host'] . ";dbname=" . $c['config']['database'], $c['config']['username'], $c['config']['password']); | |
$dbh = $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
return $dbh; | |
}); | |
$container['schema'] = $container->share(function($c) { | |
$capsule = new Capsule; | |
$capsule->addConnection($c['config']); | |
$capsule->setAsGlobal(); | |
return Capsule::schema(); | |
}); | |
// $container['phpmig.adapter'] = $container->share(function($c){ | |
// return new PDO($c['db'], 'migrations'); | |
// }); | |
$container['phpmig.adapter'] = $container->share(function() use ($container) { | |
return new \Phpmig\Adapter\Illuminate\Database($container['db'], 'migrations'); | |
}); | |
$container['phpmig.migrations_path'] = __DIR__ . DIRECTORY_SEPARATOR . 'migrations/'; | |
return $container; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Eloquent you using? This was written and tested with version 4.2