1 | <?php |
||||
2 | |||||
3 | |||||
4 | namespace Dolibarr\Client\Service; |
||||
5 | |||||
6 | use Dolibarr\Client\Domain\Proposal\Proposal; |
||||
7 | use Dolibarr\Client\Domain\Proposal\ProposalProduct; |
||||
8 | use Dolibarr\Client\Domain\Resource\ApiResource; |
||||
9 | use Dolibarr\Client\Domain\Resource\ResourceId; |
||||
10 | use Dolibarr\Client\Exception\ApiException; |
||||
11 | use Dolibarr\Client\HttpClient\HttpClientInterface; |
||||
12 | use JMS\Serializer\SerializerInterface; |
||||
13 | |||||
14 | /** |
||||
15 | * @author Laurent De Coninck <[email protected]> |
||||
16 | */ |
||||
17 | class ProposalService extends AbstractService |
||||
18 | { |
||||
19 | |||||
20 | /** |
||||
21 | * @param HttpClientInterface $httpClient |
||||
22 | * @param SerializerInterface $serializerInterface |
||||
23 | */ |
||||
24 | public function __construct( |
||||
25 | HttpClientInterface $httpClient, |
||||
26 | SerializerInterface $serializerInterface |
||||
27 | ) { |
||||
28 | parent::__construct($httpClient, $serializerInterface, new ApiResource('proposals')); |
||||
29 | } |
||||
30 | |||||
31 | /** |
||||
32 | * @param Proposal $proposal |
||||
33 | * |
||||
34 | * @return ResourceId |
||||
35 | * |
||||
36 | * @throws ApiException |
||||
37 | */ |
||||
38 | public function create(Proposal $proposal) |
||||
39 | { |
||||
40 | return new ResourceId($this->post($this->serialize($proposal))); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
41 | } |
||||
42 | |||||
43 | public function addProduct(ResourceId $proposalId, ProposalProduct $product) |
||||
44 | { |
||||
45 | return new ResourceId($this->post($this->serialize($product), [], $proposalId->getId().'/lines')); |
||||
0 ignored issues
–
show
$this->post($this->seria...Id->getId() . '/lines') of type string is incompatible with the type integer expected by parameter $id of Dolibarr\Client\Domain\R...sourceId::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
46 | } |
||||
47 | } |
||||
48 |