Closed maniaba closed 1 year ago
7.4
4.3.2
Composer (as dependency to an existing project)
Windows, Linux
apache
MySQL (ver. 8.0.28)
When I use the model() with different namespaces and the same class name it returns the wrong instance.
model()
$mns1= model(\App\Models\Document::class, true); $mns2= model(\Blog\Models\Document::class, true); if ($mns2 instanceof \Blog\Models\Document) { echo "correct instance mns2"; } else { echo "wrong instance mns2"; }
Variable $mns2 should have an instance of \Blog\Models\Document but gets it as \App\Models\Document
$mns2
\Blog\Models\Document
\App\Models\Document
No response
No, this is intended. See https://codeigniter4.github.io/CodeIgniter4/concepts/factories.html#model-example and https://codeigniter4.github.io/CodeIgniter4/concepts/factories.html#model
Thanks
PHP Version
7.4
CodeIgniter4 Version
4.3.2
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Windows, Linux
Which server did you use?
apache
Database
MySQL (ver. 8.0.28)
What happened?
When I use the
model()
with different namespaces and the same class name it returns the wrong instance.Steps to Reproduce
Expected Output
Variable
$mns2
should have an instance of\Blog\Models\Document
but gets it as\App\Models\Document
Anything else?
No response