2015-09-10 20 views
10
<?php 
namespace App\Model\Entity; 

use Cake\ORM\Entity; 

/** 
* User Entity. 
*/ 
class User extends Entity 
{ 

    /** 
    * Fields that can be mass assigned using newEntity() or patchEntity(). 
    * Note that '*' is set to true, which allows all unspecified fields to be 
    * mass assigned. For security purposes, it is advised to set '*' to false 
    * (or remove), and explicitly make individual fields accessible as needed. 
    * 
    * @var array 
    */ 
    protected $_accessible = [ 
     '*' => true, 
     'id' => false, 
    ]; 

    protected function _setPassword($value) 
    { 
     $hasher = new DefaultPasswordHasher(); 
     return $hasher->hash($value); 
    } 
} 

Oto mój kod w user.php. jestem mieszania hasła i dostał ten błądBłąd: nie znaleziono klasy "App Model Entity DefaultPassword"

Error: Class 'App\Model\Entity\DefaultPasswordHasher' not found File C:\xamp\htdocs\bookmarker\src\Model\Entity\User.php Line: 27

Odpowiedz

20

brakowało mi następujący wiersz:

use Cake\Auth\DefaultPasswordHasher; 

To był powód, dla którego mam ten błąd.

+0

Otrzymuję komunikat "Błąd: błąd składni, nieoczekiwany"? 'w tej linii. Jakaś wskazówka? – JackTheKnife

+0

@JackTheKnife sprawdź swoją składnię. –

Powiązane problemy