![]() |
Factories in docs explained badly - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Factories in docs explained badly (/showthread.php?tid=78550) |
Factories in docs explained badly - Ageir - 02-06-2021 I'm trying to figure out how to use factories in CI4. But the documentation is not up to par on explaining it. For example here:https://codeigniter.com/user_guide/concepts/factories.html Code: <?php This example seems to be a mix of the Config/Factory.php and Factories.php files mentioned above the code. Anyone here that can give a working example? Both files mentioned, and where do I place the Factories.php file? in app/Factories ? Any help would be appreciated. Thanks. RE: Factories in docs explained badly - Ageir - 02-09-2021 Code: $data = Factories::myfactoryfunction('Data'); How do I create a new Factory function like above? Shouldn't be too hard i guess, but I can't figure it out by reading the documentation. And I haven't found any examples searching the web. Any help appreciated. RE: Factories in docs explained badly - kenjis - 02-09-2021 Yes, it is difficult to understand how to use Factories. How about this? PHP Code: $data = Factories::myfactoryfunction(Data::class); RE: Factories in docs explained badly - korgoth - 02-28-2021 +1 to this, documentation basically explains nothing on this topic ![]() RE: Factories in docs explained badly - RindraCog - 11-23-2021 Hello guys, I found how to do. Create the file app/Config/Factory.php where to set these options. Then check that the namespace is Config such as te other config file (not App/Config). Hope this help you. |