Explorar el Código

User : ajout fonction getFullAddress()

refactoring
Guillaume Bourgeois hace 4 años
padre
commit
7c46297cb4
Se han modificado 2 ficheros con 13 adiciones y 5 borrados
  1. +4
    -5
      backend/controllers/DocumentController.php
  2. +9
    -0
      common/models/User.php

+ 4
- 5
backend/controllers/DocumentController.php Ver fichero

@@ -151,15 +151,14 @@ class DocumentController extends BackendController
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

if ($idUser > 0) {
$user = User::findOne($idUser);
$user = User::searchOne([
'id' => $idUser
]) ;

if ($user) {
$address = $user['lastname'] . ' ' . $user['name'] . "\n";
$address .= $user['address'];

return [
'return' => 'success',
'address' => $address
'address' => $user->getFullAddress()
];
}
}

+ 9
- 0
common/models/User.php Ver fichero

@@ -651,6 +651,14 @@ class User extends ActiveRecordCommon implements IdentityInterface
->send();
}
}

public function getFullAddress()
{
$address = '' ;
$address .= $this->lastname . ' ' . $this->name . "\n";
$address .= $this->address;
return $address ;
}
/**
* Retourne l'ID de l'utilisateur courant connecté.
@@ -684,4 +692,5 @@ class User extends ActiveRecordCommon implements IdentityInterface
return User::getCurrentStatus() == USER::STATUS_ADMIN || User::getCurrentStatus() == USER::STATUS_PRODUCER;
}


}

Cargando…
Cancelar
Guardar