All Data Structures Namespaces Files Functions Variables
CartProduct.php
Go to the documentation of this file.
<?php
namespace Entity;
class CartProduct extends ModelBase
{
protected function install()
{
$dbPrefix = $this->getDbPrefix();
$result = self::$dbo->exec("CREATE TABLE IF NOT EXISTS `{$dbPrefix}cart_product` (
`cart_id` INTEGER(11) UNSIGNED NOT NULL,
`product_id` INTEGER(11) UNSIGNED NULL,
`quantity` INTEGER(10) UNSIGNED NOT NULL,
FOREIGN KEY (`cart_id`) REFERENCES `{$dbPrefix}cart`(id),
FOREIGN KEY (`product_id`) REFERENCES `{$dbPrefix}product`(id),
UNIQUE(`cart_id`, `product_id`)
)");
if ($result === false)
throw new \Exception(get_class().": ".self::$dbo->errorInfo()[2]);
return true;
}
}
Entity
Definition: Address.php:3
Entity\CartProduct
Definition: CartProduct.php:5
Entity\CartProduct\install
install()
Definition: CartProduct.php:7
Entity\ModelBase
Definition: ModelBase.php:5