Hello.
Below is my model. (please take a look at $dom)
PHP Code:
<?php namespace App\Models;
use CodeIgniter\Model;
class SomethingModel extends Model
{
public function doSomething()
{
// do something
$dom = new DOMDocument();
}
}
?>
I cannot instantiate DOMDocument.
Error logs showed this:
CRITICAL - 2023-08-11 11:05:10 --> Class 'App\Models\DOMDocument' not found
As if it thinks I'm referencing a model.
But when I do the same on View files, it has no problem.
(08-10-2023, 08:14 PM)mshahrim Wrote: Hello.
Below is my model. (please take a look at $dom)
PHP Code:
<?php namespace App\Models;
use CodeIgniter\Model;
class SomethingModel extends Model
{
public function doSomething()
{
// do something
$dom = new DOMDocument();
}
}
?>
I cannot instantiate DOMDocument.
Error logs showed this:
CRITICAL - 2023-08-11 11:05:10 --> Class 'App\Models\DOMDocument' not found
As if it thinks I'm referencing a model.
But when I do the same on View files, it has no problem.
Okay, I have found the solution.
Since I need to instantiate DOMDocument, the PHP built-in objects, all I need to do is just add this declaration: