@@ -242,8 +242,13 @@ public function bake(string $type, string $className, Arguments $args, ConsoleIo
242242 $ prefix = $ this ->getPrefix ($ args );
243243 $ fullClassName = $ this ->getRealClassName ($ type , $ className , $ prefix );
244244
245+ // Check if fixture factories plugin is available
246+ $ hasFixtureFactories = $ this ->hasFixtureFactories ();
247+
245248 if (!$ args ->getOption ('no-fixture ' )) {
246- if ($ args ->getOption ('fixtures ' )) {
249+ if ($ hasFixtureFactories ) {
250+ $ io ->info ('Fixture Factories plugin detected - skipping fixture property generation. ' );
251+ } elseif ($ args ->getOption ('fixtures ' )) {
247252 $ fixtures = array_map ('trim ' , explode (', ' , $ args ->getOption ('fixtures ' )));
248253 $ this ->_fixtures = array_filter ($ fixtures );
249254 } elseif ($ this ->typeCanDetectFixtures ($ type ) && class_exists ($ fullClassName )) {
@@ -277,6 +282,7 @@ public function bake(string $type, string $className, Arguments $args, ConsoleIo
277282 $ contents = $ this ->createTemplateRenderer ()
278283 ->set ('fixtures ' , $ this ->_fixtures )
279284 ->set ('plugin ' , $ this ->plugin )
285+ ->set ('hasFixtureFactories ' , $ hasFixtureFactories )
280286 ->set (compact (
281287 'subject ' ,
282288 'className ' ,
@@ -305,6 +311,17 @@ public function bake(string $type, string $className, Arguments $args, ConsoleIo
305311 return false ;
306312 }
307313
314+ /**
315+ * Check if the CakePHP Fixture Factories plugin is available
316+ *
317+ * @return bool
318+ */
319+ protected function hasFixtureFactories (): bool
320+ {
321+ return class_exists ('CakephpFixtureFactories\Plugin ' )
322+ || class_exists ('CakephpFixtureFactories\CakephpFixtureFactoriesPlugin ' );
323+ }
324+
308325 /**
309326 * Checks whether the chosen type can find its own fixtures.
310327 * Currently only model, and controller are supported
0 commit comments