No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

43 líneas
931B

  1. <?php
  2. namespace App\Logic;
  3. use App\Features\InstanceAble;
  4. use App\Kintone\Models\Ask;
  5. use App\Kintone\Models\Customer;
  6. use App\Util\DateUtil;
  7. use LogicException;
  8. class AskManager
  9. {
  10. use InstanceAble;
  11. private Customer|null $customer = null;
  12. public function __construct(private Ask $model)
  13. {
  14. }
  15. public function setCustomer(Customer $customer): static
  16. {
  17. $this->customer = $customer;
  18. return $this;
  19. }
  20. public function make(string $genre, string $ask)
  21. {
  22. if ($this->customer === null) {
  23. throw new LogicException("顧客NULL");
  24. }
  25. $this->model->set(Ask::FIELD_ASK_DATETIME, DateUtil::now());
  26. $this->model->set(Ask::FIELD_GENRE, $genre);
  27. $this->model->set(Ask::FIELD_ASK, $ask);
  28. $this->model->set(Ask::FIELD_CUSTOMER_CODE, $this->customer->getStr(Customer::FIELD_CUSTOMER_CODE));
  29. return $this->model;
  30. }
  31. }