You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Clients.php 1016B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Shop\DB;
  3. use Shop\DB\myDB;
  4. use Shop\Model\Clients as ClientModel;
  5. class Clients extends myDB
  6. {
  7. protected $container;
  8. protected $clients = [];
  9. public function __construct($container)
  10. {
  11. $this->container = $container;
  12. }
  13. public function getClients()
  14. {
  15. $stmt = $this->container->get('db')->prepare("SELECT * FROM clients;");
  16. $res = $stmt->execute();
  17. while($result = $res->fetchArray(SQLITE3_ASSOC)) {
  18. $client = new ClientModel($this->container);
  19. $client->setId($result['id']);
  20. $client->setFirstname($result['firstname']);
  21. $client->setLastname($result['lastname']);
  22. $client->setCompany($result['company']);
  23. $client->setVatnumber($result['vatnumber']);
  24. $client->setStreet($result['street']);
  25. $client->setStreet2($result['street2']);
  26. $client->setZipcode($result['zipcode']);
  27. $client->setCity($result['city']);
  28. $client->setState($result['state']);
  29. $client->setCountry($result['country']);
  30. $this->clients[] = $client;
  31. }
  32. return $this->clients;
  33. }
  34. }