Exemplo n.º 1
0
 /**
  * This method is meant to be called during the installation of the plugin to allow use of the Model Helper.
  *
  * @param Shopware_Components_Plugin_Bootstrap $bootstrap
  *
  * @throws Exception
  * @return void
  */
 public static function install($bootstrap)
 {
     try {
         $models = Shopware()->Models();
         Shopware()->Db()->query("DROP TABLE IF EXISTS `paymill_fastCheckout`;");
         //Add Order Properties
         $models->addAttribute('s_order_attributes', 'paymill', 'pre_authorization', 'varchar(255)');
         $models->addAttribute('s_order_attributes', 'paymill', 'transaction', 'varchar(255)');
         $models->addAttribute('s_order_attributes', 'paymill', 'refund', 'varchar(255)');
         $models->addAttribute('s_order_attributes', 'paymill', 'sepa_date', 'int(11)');
         //Add User Properties
         $models->addAttribute('s_user_attributes', 'paymill', 'client_id', 'varchar(255)');
         $models->addAttribute('s_user_attributes', 'paymill', 'payment_id_cc', 'varchar(255)');
         $models->addAttribute('s_user_attributes', 'paymill', 'payment_id_elv', 'varchar(255)');
         //Persist changes
         $bootstrap->Application()->Models()->generateAttributeModels(array('s_order_attributes'));
         $bootstrap->Application()->Models()->generateAttributeModels(array('s_user_attributes'));
     } catch (Exception $exception) {
         throw new Exception("Cannot edit shopware models. " . $exception->getMessage());
     }
 }