PaylaterProduct   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadByIdProduct() 0 11 1
1
<?php
2
/**
3
* 2007-2017 PrestaShop
4
*
5
* NOTICE OF LICENSE
6
*
7
* This source file is subject to the Academic Free License (AFL 3.0)
8
* that is bundled with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://opensource.org/licenses/afl-3.0.php
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to [email protected] so we can send you a copy immediately.
14
*
15
* DISCLAIMER
16
*
17
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18
* versions in the future. If you wish to customize PrestaShop for your
19
* needs please refer to http://www.prestashop.com for more information.
20
*
21
*  @author    PrestaShop SA <[email protected]>
22
*  @copyright 2007-2017 PrestaShop SA
23
*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
24
*  International Registered Trademark & Property of PrestaShop SA
25
*/
26
27
class PaylaterProduct extends ObjectModel
28
{
29
    /** @var string Name */
30
    public $id_paylater;
31
32
    /** @var integer */
33
    public $id_product;
34
35
    /** @var integer */
36
    public $is_discount;
37
38
    /**
39
     * @see ObjectModel::$definition
40
     */
41
    public static $definition = array(
42
        'table' => 'paylater_product',
43
        'primary' => 'id_paylater',
44
        'multilang' => false,
45
        'fields' => array(
46
            'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
47
            'is_discount' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
48
        ),
49
    );
50
51
    public static function loadByIdProduct($id_product)
52
    {
53
        $result = Db::getInstance()->getRow(
54
            'SELECT *
55
            FROM `'._DB_PREFIX_.'paylater_product` sample
56
            WHERE sample.`id_product` = '.
57
            (int)$id_product
58
        );
59
60
        return new PaylaterProduct($result['id_paylater']);
61
    }
62
}
63