Added to the basic app, fixed config, added to core commands.

This commit is contained in:
Mark
2014-01-04 01:16:05 +04:00
parent 6291d0c249
commit ccfb7638d0
5 changed files with 38 additions and 2 deletions

View File

@ -103,11 +103,18 @@ class FixtureController extends Controller
* you can specify table name as a second parameter.
* @param string $fixture
*/
public function actionApply($fixture)
public function actionApply(array $fixture)
{
if ($this->getFixtureManager() == null) {
throw new Exception(
'Fixture manager is not configured properly. '
. 'Please refer to official documentation for this purposes.');
}
$this->getFixtureManager()->basePath = $this->fixturePath;
$this->getFixtureManager()->db = $this->db;
$this->loadFixtures([$fixture]);
$this->loadFixtures($fixture);
$this->notifySuccess($fixture);
}
/**
@ -150,4 +157,18 @@ class FixtureController extends Controller
return $db;
}
/**
* Notifies user that fixtures were successfully loaded.
* @param array $fixtures
*/
private function notifySuccess($fixtures)
{
$this->stdout("Fixtures were successfully loaded from path: \n", Console::FG_YELLOW);
$this->stdout(realpath(Yii::getAlias($this->fixturePath)) . "\n\n", Console::FG_GREEN);
foreach($fixtures as $index => $fixture) {
$this->stdout($index +1 . ". " . $fixture . "\n", Console::FG_GREEN);
}
}
}