mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Enhanced FixtureController::getFixtureRelativeName()
Updated CHANGELOG
This commit is contained in:
@ -29,6 +29,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #13513: Fixed RBAC migration to work correctly on Oracle DBMS (silverfire)
|
||||
- Bug #13537: Fixed `yii\web\CacheSession::destroySession()` to work correctly when session is not written yet (silverfire, papalapa)
|
||||
- Bug #13538: Fixed `yii\db\BaseActiveRecord::deleteAll()` changes method signature declared by `yii\db\ActiveRecordInterface::deleteAll()` (klimov-paul)
|
||||
- Bug #13551: Fixed `FixtureController` to load fixtures from subdirectories (d1rtyf1ng3rs, silverfire)
|
||||
- Bug #13571: Fix `yii\db\mssql\QueryBuilder::checkIntegrity` for all tables (boboldehampsink)
|
||||
- Bug #13577: `yii\db\QueryBuilder::truncateTable` should work consistent over all databases (boboldehampsink)
|
||||
- Bug #13582: PK column in `yii\db\pgsql\QueryBuilder::resetSequence()` was not quoted properly (boboldehampsink)
|
||||
|
@ -415,33 +415,28 @@ class FixtureController extends Controller
|
||||
$foundFixtures = [];
|
||||
|
||||
foreach ($files as $fixture) {
|
||||
$relativeName = $this->getFixtureRelativeName($fixture);
|
||||
$foundFixtures[] = $relativeName;
|
||||
$foundFixtures[] = $this->getFixtureRelativeName($fixture);
|
||||
}
|
||||
|
||||
return $foundFixtures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates $fixture's name relatively to $templatePath.
|
||||
* Basically, strips getFixturePath() and 'Fixture.php' prefix from fixture's full path
|
||||
* Calculates fixture's name
|
||||
* Basically, strips [[getFixturePath()]] and `Fixture.php' suffix from fixture's full path
|
||||
* @see getFixturePath()
|
||||
* @param string $fullFixturePath Full fixture path
|
||||
* @return string Relative fixture name
|
||||
*/
|
||||
private function getFixtureRelativeName($fullFixturePath)
|
||||
{
|
||||
// $fixturesPath is normalized to unix format in getFixturesPath()
|
||||
$fixturesPath = $this->getFixturePath();
|
||||
// normalize $fixture to unix format
|
||||
$fullFixturePath = str_replace("\\", "/", $fullFixturePath);
|
||||
// strip $fixturesPath from $fixture's full path
|
||||
$relativeName = str_replace($fixturesPath . "/", "", $fullFixturePath);
|
||||
// get fixtures's directory
|
||||
$relativeDir = dirname($relativeName) === '.' ? '' : dirname($relativeName) . '/';
|
||||
// get fixture name relatively to $fixturesPath
|
||||
$relativeName = $relativeDir . basename($fullFixturePath, 'Fixture.php');
|
||||
return $relativeName;
|
||||
$fixturesPath = FileHelper::normalizePath($this->getFixturePath());
|
||||
$fullFixturePath = FileHelper::normalizePath($fullFixturePath);
|
||||
|
||||
$relativeName = substr($fullFixturePath, strlen($fixturesPath)+1);
|
||||
$relativeDir = dirname($relativeName) === '.' ? '' : dirname($relativeName) . DIRECTORY_SEPARATOR;
|
||||
|
||||
return $relativeDir . basename($fullFixturePath, 'Fixture.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user