Welcome Guest, Not a member yet? Register   Sign In
Model / Entities relation
#4

(This post was last modified: 02-26-2019, 02:35 AM by puschie.)

you override the magic methods of the Entity class in your User entity - try your original version with protected members:
PHP Code:
<?php namespace App\Entities;

use 
CodeIgniter\Entity;

class 
User extends Entity
{
 
   protected $id;
 
   protected $firstname;
 
   protected $lastname;
 
   protected $username;
 
   protected $email;
 
   protected $password;
 
   protected $created_at;
 
   protected $updated_at;
 
   protected $deleted;
 
   protected $deleted_at;

 
   protected $_options = [
 
       'datamap' => [
 
           'full_name' => 'username'
 
       ],
 
       'dates' => ['created_at''updated_at''deleted_at'],
 
       'casts' => [
 
           'deleted' => 'boolean'
 
       ],
 
   ];

 
   public function setPassword(string $pass)
 
   {
 
       $this->password password_hash($passPASSWORD_BCRYPT);
 
       return $this;
 
   }



PS: if this doesnt work pls provide more details about what went wrong. apart your model property visibility everything else looks valid to me
Other Ref: https://github.com/lonnieezell/myth-auth...s/User.php
Reply


Messages In This Thread
Model / Entities relation - by keulu - 02-20-2019, 02:45 AM
RE: Model / Entities relation - by puschie - 02-22-2019, 03:10 AM
RE: Model / Entities relation - by keulu - 02-22-2019, 07:09 AM
RE: Model / Entities relation - by puschie - 02-25-2019, 07:17 AM
RE: Model / Entities relation - by keulu - 02-26-2019, 11:31 AM
RE: Model / Entities relation - by keulu - 02-26-2019, 01:41 PM
RE: Model / Entities relation - by keulu - 02-27-2019, 11:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB