Welcome Guest, Not a member yet? Register   Sign In
About Entities declaration
#1

Hello World (First message :p)

I followed the example of the documentation for the use of entities:
creation of the User.php file in the app/Entities folder with User Class definition extends Entity.
added protected line $returnType = 'App\Entities\User'; in the UserModel model

But when using $user = new App\Entities\User(); in the controller I have the error Class 'App\Controllers\App\Entities\User' not found. However, this is the line noted in the documentation https://codeigniter.com/user_guide/models/entities.html

I understand the logic so with
$user = new \App\Entities\User();
it's OK

and with
use App\Entities\User;
...
$user = new User();

But following the documentation in a way I think logical, I looked for a moment why it didn't work.

Is it me who didn't understand, a problem in the documentation or in the functioning of the entities.
Reply


Messages In This Thread
About Entities declaration - by Majddar - 04-29-2020, 12:18 AM
RE: About Entities declaration - by jreklund - 04-29-2020, 10:42 AM
RE: About Entities declaration - by Majddar - 04-29-2020, 11:34 AM
RE: About Entities declaration - by HTLove - 05-03-2020, 07:20 PM
RE: About Entities declaration - by Majddar - 05-04-2020, 12:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB