Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. namespace BestShop\Product;
  3.  
  4. use Db;
  5. use BestShop\Database\DbQuery;
  6. use BestShop\ObjectModel;
  7.  
  8. class Product extends ObjectModel {
  9. /** @var $id Product ID */
  10. public $id;
  11.  
  12. /** @var int $category_id */
  13. public $category_id;
  14.  
  15. /** @var string $name */
  16. public $name;
  17.  
  18. /** @var string $description */
  19. public $description;
  20.  
  21. /** @var int $price */
  22. public $price = 0;
  23.  
  24. /** @var $date_add */
  25. public $date_add;
  26.  
  27. /** @var $date_upd */
  28. public $date_upd;
  29.  
  30. /**
  31. * @see ObjectModel::$definition
  32. */
  33. public static $definition = array(
  34. 'table' => 'product',
  35. 'primary' => 'product_id',
  36. 'fields' => array(
  37. 'category_id' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'size' => 11),
  38. 'name' => array('type' => self::TYPE_STRING, 'required' => true, 'validate' => 'isString', 'size' => 32),
  39. 'description' => array('type' => self::TYPE_STRING, 'required' => true),
  40. 'price' => array('type' => self::TYPE_FLOAT, 'required' => true),
  41. 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
  42. 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
  43. )
  44. );
  45.  
  46. /**
  47. * constructor.
  48. *
  49. * @param null $id
  50. */
  51. public function __construct($id = null)
  52. {
  53. parent::__construct($id);
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement