'inpost_dispatch_order', 'primary' => 'id_dispatch_order', 'fields' => [ 'id_dispatch_point' => [ 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'allow_null' => true, ], 'shipx_dispatch_order_id' => [ 'type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'allow_null' => true, ], 'number' => [ 'type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'allow_null' => true, ], 'price' => [ 'type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'allow_null' => true, ], 'status' => [ 'type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 64, ], 'date_add' => [ 'type' => self::TYPE_DATE, 'validate' => 'isDate', ], ], 'associations' => [ 'shipments' => [ 'type' => self::HAS_MANY, 'field' => 'id_dispatch_order', 'foreign_field' => 'id_dispatch_order', 'object' => 'InPostShipmentModel', ], ], ]; public function add($auto_date = true, $null_values = true) { return parent::add($auto_date, $null_values); } public function update($null_values = true) { return parent::update($null_values); } /** @return self[] */ public static function getDispatchOrders($sandbox, $organizationId, array $ids = []) { $query = (new DbQuery()) ->select('do.*') ->from('inpost_dispatch_order', 'do') ->innerJoin('inpost_shipment', 's', 's.id_dispatch_order = do.id_dispatch_order') ->where('s.sandbox = ' . ($sandbox ? 1 : 0)) ->where('s.organization_id = ' . (int) $organizationId); if (!empty($ids)) { $query->where('id_dispatch_order IN (' . implode(',', array_map('intval', $ids)) . ')'); } return self::hydrateCollection( self::class, Db::getInstance()->executeS($query) ); } }