File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Yii Framework 2 Change Log
442.0.38 under development
55------------------------
66
7+ - Enh #18213 : Do not load fixtures with circular dependencies twice instead of throwing an exception (JesseHines0)
78- Bug #18066 : Fixed ` yii\db\Query::create() ` wasn't using all info from ` withQuery() ` (maximkou)
89- Bug #18269 : Fix integer safe attribute to work properly in ` yii\base\Model ` (Ladone)
910- Enh #18236 : Allow ` yii\filters\RateLimiter ` to accept a closure function for the ` $user ` property in order to assign values on runtime (nadar)
Original file line number Diff line number Diff line change @@ -165,12 +165,11 @@ public function getFixture($name)
165165
166166 /**
167167 * Creates the specified fixture instances.
168- * All dependent fixtures will also be created.
168+ * All dependent fixtures will also be created. Duplicate fixtures and circular dependencies will only be created once.
169169 * @param array $fixtures the fixtures to be created. You may provide fixture names or fixture configurations.
170170 * If this parameter is not provided, the fixtures specified in [[globalFixtures()]] and [[fixtures()]] will be created.
171171 * @return Fixture[] the created fixture instances
172- * @throws InvalidConfigException if fixtures are not properly configured or if a circular dependency among
173- * the fixtures is detected.
172+ * @throws InvalidConfigException if fixtures are not properly configured
174173 */
175174 protected function createFixtures (array $ fixtures )
176175 {
@@ -210,9 +209,8 @@ protected function createFixtures(array $fixtures)
210209 // need to use the configuration provided in test case
211210 $ stack [] = isset ($ config [$ dep ]) ? $ config [$ dep ] : ['class ' => $ dep ];
212211 }
213- } elseif ($ instances [$ name ] === false ) {
214- throw new InvalidConfigException ("A circular dependency is detected for fixture ' $ class'. " );
215212 }
213+ // if the fixture is already loaded (ie. a circular dependency or if two fixtures depend on the same fixture) just skip it.
216214 }
217215 }
218216
You can’t perform that action at this time.
0 commit comments