Welcome Guest, Not a member yet? Register   Sign In
Factories::models breaks __callStatic function arguments passed to the class
#4

I used to call my models trough CI Factory -> Models which previously allowed me to pass custom arguments, here's what my typical CI model looks (stripped comments for this thread):
PHP Code:
class Envelope extends Core
{
    public function __construct(
        protected string|int $context,
        protected string $to,
        protected string $subject,
        protected string $body,
        protected array|object $dataset = []
    ) {
        parent::__construct(
            'email_envelope',
            primaryKey'envelope_id',
            returnType'MyPackage\Email\Entity\Envelope',
          ... 

Previously i could call model(options, arguments) and extract $arguments into new model constructor.

PHP Code:
Factories::model($name, ['instanceOf' => $path'preferApp'  => false'getShared'  => false], $arguments

But now in updated code that i mentioned in creation of this thread this cannot work anymore. Alright, no big deal.

Just try not to create constraints for developers Smile i always keep it in mind and ask my self "by implementing this: am i limiting anything/creating a constraint".
Reply


Messages In This Thread
RE: Factories::models breaks __callStatic function arguments passed to the class - by stopz - 10-27-2022, 02:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB