1 | <?php |
||
10 | class ProfileService |
||
11 | { |
||
12 | /** |
||
13 | * Initialisation du service avec les repository utilisés |
||
14 | * |
||
15 | * @param SDIS62\Core\User\Repository\ProfileRepositoryInterface $profile_repository |
||
16 | * @param SDIS62\Core\User\Repository\UserRepositoryInterface $user_repository |
||
17 | */ |
||
18 | 18 | public function __construct(ProfileRepositoryInterface $profile_repository, |
|
24 | |||
25 | /** |
||
26 | * Retourne un grade correspondant à l'id spécifié |
||
27 | * |
||
28 | * @param int $id_profile |
||
29 | * @return SDIS62\Core\User\Entity\Profile |
||
30 | */ |
||
31 | 6 | public function find($id_profile) |
|
35 | |||
36 | /** |
||
37 | * Retourne les profils d'un utilisateur |
||
38 | * |
||
39 | * @param int $id_user |
||
40 | * @return SDIS62\Core\User\Entity\Profile[] |
||
41 | */ |
||
42 | 3 | public function findAllByUser($id_user) |
|
46 | |||
47 | /** |
||
48 | * Sauvegarde d'un profil |
||
49 | * |
||
50 | * <code> |
||
51 | * $array = array( |
||
52 | * 'type' => 'sapeur_pompier|personnel_administratif|personnel_technique|maire', |
||
53 | * 'grade' => 'Nom du grade (pour sapeur_pompier|personnel_administratif|personnel_technique)', |
||
54 | * 'poste' => 'Nom du poste (pour sapeur_pompier|personnel_administratif|personnel_technique)', |
||
55 | * 'pro' => 'true (pour sapeur_pompier)', |
||
56 | * 'code_insee' => '62001 (pour maire)' |
||
57 | * ); |
||
58 | * </code> |
||
59 | * |
||
60 | * @param array $data |
||
61 | * @return SDIS62\Core\User\Entity\Profile |
||
62 | */ |
||
63 | 6 | public function save(array $data) |
|
106 | |||
107 | /** |
||
108 | * Suppression d'un profil |
||
109 | * |
||
110 | * @param int $id_profile |
||
111 | */ |
||
112 | 3 | public function delete($id_profile) |
|
117 | } |
||
118 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: