XoopsModules25x /
oledrion
| 1 | <?php |
||
| 2 | |||
| 3 | namespace XoopsModules\Oledrion; |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * oledrion |
||
| 17 | * |
||
| 18 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 19 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 20 | * @author Hossein Azizabadi ([email protected]) |
||
| 21 | */ |
||
| 22 | |||
| 23 | use XoopsModules\Oledrion; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Class LocationDeliveryHandler |
||
| 27 | */ |
||
| 28 | class LocationDeliveryHandler extends OledrionPersistableObjectHandler |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * LocationDeliveryHandler constructor. |
||
| 32 | * @param \XoopsDatabase|null $db |
||
| 33 | */ |
||
| 34 | public function __construct(\XoopsDatabase $db = null) |
||
| 35 | { |
||
| 36 | // Table Classe Id |
||
| 37 | parent::__construct($db, 'oledrion_location_delivery', LocationDelivery::class, 'ld_id'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param $parameters |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | public function getLocationDeliveryId($parameters) |
||
| 45 | { |
||
| 46 | $ret = []; |
||
| 47 | if (!$parameters['location']) { |
||
| 48 | return $ret; |
||
| 49 | } |
||
| 50 | $critere = new \CriteriaCompo(); |
||
| 51 | $critere->add(new \Criteria('ld_location', $parameters['location'])); |
||
| 52 | $obj = $this->getObjects($critere); |
||
| 53 | if ($obj) { |
||
|
0 ignored issues
–
show
The expression
$obj of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using Loading history...
|
|||
| 54 | foreach ($obj as $root) { |
||
| 55 | $tab = $root->toArray(); |
||
| 56 | $ret[$root->getVar('ld_delivery')] = $tab; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | return $ret; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $ld_delivery |
||
| 65 | * @param $ld_location |
||
| 66 | * @return array |
||
| 67 | */ |
||
| 68 | public function getDelivery($ld_delivery, $ld_location) |
||
| 69 | { |
||
| 70 | $ret = []; |
||
| 71 | $critere = new \CriteriaCompo(); |
||
| 72 | $critere->add(new \Criteria('ld_delivery', $ld_delivery)); |
||
| 73 | $critere->add(new \Criteria('ld_location', $ld_location)); |
||
| 74 | $critere->setLimit(1); |
||
| 75 | $obj = $this->getObjects($critere); |
||
| 76 | if ($obj) { |
||
|
0 ignored issues
–
show
The expression
$obj of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using Loading history...
|
|||
| 77 | foreach ($obj as $root) { |
||
| 78 | $tab = []; |
||
| 79 | $ret = $root->toArray(); |
||
| 80 | } |
||
| 81 | } |
||
| 82 | |||
| 83 | return $ret; |
||
| 84 | } |
||
| 85 | } |
||
| 86 |