From 9ca2e7f3b212ca7434bb169f7c1b9ac0f8b2b22e Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 17 Jul 2026 23:04:59 +0200 Subject: param ?Client dans newService() et modifyData(), gitignore, config-template --- src/model/entities/Client.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/model/entities/Client.php') 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 return true; } - public static function getObject(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults) // renvoie un Client ou 0 + public static function find(ZenityEntry $SearchCustomerForm, ZenityList $SearchCustomerResults): ?Client { // fenêtres /*$SearchCustomerForm = new ZenityEntry(ZenitySetup::$recherche_client_text); @@ -228,11 +228,11 @@ class Client if($input == '') // commenter ce if pour qu'une saisie vide permette d'obtenir tous les clients { echo "debug: recherche annulée ou saisie vide\n"; - return 0; + return null; } echo "debug: recherche effectuée\n"; - $MatchedObjects = self::searchCustomer($input, $Customer); + $MatchedObjects = self::search($input, $Customer); if(count($MatchedObjects) === 0) // si aucun client ne correspond, les prendre tous! { $repository = self::$entityManager->getRepository('Client'); @@ -241,7 +241,7 @@ class Client if(count($MatchedObjects) === 0) // toujours rien { echo "debug: aucun client dans la base de données\n"; - return 0; + return null; } } @@ -261,7 +261,7 @@ class Client if($input == '') { echo "debug: client pas trouvé ou pas sélectionné\n"; - return 0; + return null; } echo "debug: client sélectionné\n"; @@ -273,7 +273,7 @@ class Client return $Customer; } - private static function searchCustomer(string $input, Client $Customer): array + private static function search(string $input, Client $Customer): array { $input_array = explode(' ', $input); // si plusieurs mot, on les recherche tous l'un après l'autre return $Customer->findByKeywords($input_array, 'prenom_nom'); // on obtient un tableau à deux dimensions avec les entrées trouvées -- cgit v1.2.3