diff options
Diffstat (limited to 'src/model/entities/Client.php')
| -rw-r--r-- | src/model/entities/Client.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/model/entities/Client.php b/src/model/entities/Client.php index 7dd3be6..a81519a 100644 --- a/src/model/entities/Client.php +++ b/src/model/entities/Client.php | |||
| @@ -216,7 +216,7 @@ class Client | |||
| 216 | return true; | 216 | return true; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | public static function getObject(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults) // renvoie un Client ou 0 | 219 | public static function find(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults): ?Client |
| 220 | { | 220 | { |
| 221 | // fenêtres | 221 | // fenêtres |
| 222 | /*$SearchCustomerForm = new ZenityEntry(ZenitySetup::$recherche_client_text); | 222 | /*$SearchCustomerForm = new ZenityEntry(ZenitySetup::$recherche_client_text); |
| @@ -228,11 +228,11 @@ class Client | |||
| 228 | if($input == '') // commenter ce if pour qu'une saisie vide permette d'obtenir tous les clients | 228 | if($input == '') // commenter ce if pour qu'une saisie vide permette d'obtenir tous les clients |
| 229 | { | 229 | { |
| 230 | echo "debug: recherche annulée ou saisie vide\n"; | 230 | echo "debug: recherche annulée ou saisie vide\n"; |
| 231 | return 0; | 231 | return null; |
| 232 | } | 232 | } |
| 233 | echo "debug: recherche effectuée\n"; | 233 | echo "debug: recherche effectuée\n"; |
| 234 | 234 | ||
| 235 | $MatchedObjects = self::searchCustomer($input, $Customer); | 235 | $MatchedObjects = self::search($input, $Customer); |
| 236 | if(count($MatchedObjects) === 0) // si aucun client ne correspond, les prendre tous! | 236 | if(count($MatchedObjects) === 0) // si aucun client ne correspond, les prendre tous! |
| 237 | { | 237 | { |
| 238 | $repository = self::$entityManager->getRepository('Client'); | 238 | $repository = self::$entityManager->getRepository('Client'); |
| @@ -241,7 +241,7 @@ class Client | |||
| 241 | if(count($MatchedObjects) === 0) // toujours rien | 241 | if(count($MatchedObjects) === 0) // toujours rien |
| 242 | { | 242 | { |
| 243 | echo "debug: aucun client dans la base de données\n"; | 243 | echo "debug: aucun client dans la base de données\n"; |
| 244 | return 0; | 244 | return null; |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
| 247 | 247 | ||
| @@ -261,7 +261,7 @@ class Client | |||
| 261 | if($input == '') | 261 | if($input == '') |
| 262 | { | 262 | { |
| 263 | echo "debug: client pas trouvé ou pas sélectionné\n"; | 263 | echo "debug: client pas trouvé ou pas sélectionné\n"; |
| 264 | return 0; | 264 | return null; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | echo "debug: client sélectionné\n"; | 267 | echo "debug: client sélectionné\n"; |
| @@ -273,7 +273,7 @@ class Client | |||
| 273 | return $Customer; | 273 | return $Customer; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | private static function searchCustomer(string $input, Client $Customer): array | 276 | private static function search(string $input, Client $Customer): array |
| 277 | { | 277 | { |
| 278 | $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre | 278 | $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre |
| 279 | return $Customer->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées | 279 | return $Customer->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées |
