Przeglądaj źródła

User : ajout fonction getFullAddress()

refactoring
Guillaume Bourgeois 4 lat temu
rodzic
commit
7c46297cb4
2 zmienionych plików z 13 dodań i 5 usunięć
  1. +4
    -5
      backend/controllers/DocumentController.php
  2. +9
    -0
      common/models/User.php

+ 4
- 5
backend/controllers/DocumentController.php Wyświetl plik

@@ -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 Wyświetl plik

@@ -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;
}


}

Ładowanie…
Anuluj
Zapisz