Conditions | 2 |
Paths | 7 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace App\Repositories; |
||
14 | public function store(array $data) |
||
15 | { |
||
16 | $this->validate($data); |
||
17 | |||
18 | try |
||
19 | { |
||
20 | $detail = new SaleDetails(); |
||
21 | |||
22 | $detail->sale_id = intval($data['sale_id']); |
||
|
|||
23 | $detail->product_id = intval($data['product_id']); |
||
24 | $detail->quantity = intval($data['quantity']); |
||
25 | $detail->current_price = floatval($data['current_price']); |
||
26 | |||
27 | $detail->save(); |
||
28 | } |
||
29 | catch(\Exception $e) |
||
30 | { |
||
31 | throw new RepositoryException("Could not store sale detail: ".$e->getMessage(), RepositoryException::DATABASE_ERROR); |
||
32 | } |
||
33 | } |
||
34 | |||
51 | } |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.