Fixture Factory & CakeDC/Users #160
-
Recently I've faced an issue trying to use plugins CakeDC/Users & Fixture Factories. My project is running CakePHP 4.3 and the latest versions for both plugins. I've found that if you are using a
To fix it, I should load the
I dont understand why I'm forced to do that way. I believed that since Cake 3.7 or nearly you should load plugins in Can someone explain it to me because I don't seem to understand 🤯 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @Petrucheqa, thanks for the input. The answer lies in the stack trace :-) Since this config is vital for the UserFactory, I would load the config, if not loaded, in the If this is not clear, you can paste your test, and I'll pinpoint the explanation above. |
Beta Was this translation helpful? Give feedback.
Hi @Petrucheqa,
thanks for the input. The answer lies in the stack trace :-)
Application.php
's bootstrap will indeed load the configuration. But you probably call the factory before the Application gets loaded.In your factory's default template, you probably have a default password value. The setter in
Entity/User.php:66
will thus be triggered.Therefor, the config is not loaded yet by the time you call the factory.
Since this config is vital for the UserFactory, I would load the config, if not loaded, in the
initialize()
method of the factory.If this is not clear, you can paste your test, and I'll pinpoint the explanation above.