get() abstract public method

Gets the entity with the given id.
abstract public get ( string $id ) : void
$id string the id
return void the entity belonging to the id or null if not existant
Example #1
0
 /**
  * Determines whether the entity needs a new hash generated.
  *
  * @param AbstractData $data
  * the CRUDlex data instance of the user entity
  * @param Entity $entity
  * the entity
  * @param string $passwordField
  * the field holding the password hash in the entity
  * @param string $password
  * the current password hash
  * @param boolean $newSalt
  * whether a new password hash salt was generated
  *
  * @return boolean
  * true if the entity needs a new hash
  */
 public function doGenerateHash(AbstractData $data, Entity $entity, $passwordField, $password, $newSalt)
 {
     $doGenerateHash = true;
     $id = $entity->get('id');
     if ($id !== null) {
         $oldEntity = $data->get($entity->get('id'));
         $doGenerateHash = $oldEntity->get($passwordField) !== $password || $newSalt;
     }
     return $doGenerateHash;
 }