     1: <?php
     2:
     3: namespace Thelia\Model\map;
     4:
     5: use \RelationMap;
     6: use \TableMap;
     7:
     8:
     9: /**
    10:  * This class defines the structure of the 'order' table.
    11:  *
    12:  *
    13:  *
    14:  * This map class is used by Propel to do runtime db structure discovery.
    15:  * For example, the createSelectSql() method checks the type of a given column used in an
    16:  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
    17:  * (i.e. if it's a text column type).
    18:  *
    19:  * @package    propel.generator.Thelia.Model.map
    20:  */
    21: class OrderTableMap extends TableMap
    22: {
    23:
    24:     /**
    25:      * The (dot-path) name of this class
    26:      */
    27:     const CLASS_NAME = 'Thelia.Model.map.OrderTableMap';
    28:
    29:     /**
    30:      * Initialize the table attributes, columns and validators
    31:      * Relations are not initialized by this method since they are lazy loaded
    32:      *
    33:      * @return void
    34:      * @throws PropelException
    35:      */
    36:     public function initialize()
    37:     {
    38:         // attributes
    39:         $this->setName('order');
    40:         $this->setPhpName('Order');
    41:         $this->setClassname('Thelia\\Model\\Order');
    42:         $this->setPackage('Thelia.Model');
    43:         $this->setUseIdGenerator(true);
    44:         // columns
    45:         $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
    46:         $this->addColumn('ref', 'Ref', 'VARCHAR', false, 45, null);
    47:         $this->addForeignKey('customer_id', 'CustomerId', 'INTEGER', 'customer', 'id', true, null, null);
    48:         $this->addForeignKey('address_invoice', 'AddressInvoice', 'INTEGER', 'order_address', 'id', false, null, null);
    49:         $this->addForeignKey('address_delivery', 'AddressDelivery', 'INTEGER', 'order_address', 'id', false, null, null);
    50:         $this->addColumn('invoice_date', 'InvoiceDate', 'DATE', false, null, null);
    51:         $this->addForeignKey('currency_id', 'CurrencyId', 'INTEGER', 'currency', 'id', false, null, null);
    52:         $this->addColumn('currency_rate', 'CurrencyRate', 'FLOAT', true, null, null);
    53:         $this->addColumn('transaction', 'Transaction', 'VARCHAR', false, 100, null);
    54:         $this->addColumn('delivery_num', 'DeliveryNum', 'VARCHAR', false, 100, null);
    55:         $this->addColumn('invoice', 'Invoice', 'VARCHAR', false, 100, null);
    56:         $this->addColumn('postage', 'Postage', 'FLOAT', false, null, null);
    57:         $this->addColumn('payment', 'Payment', 'VARCHAR', true, 45, null);
    58:         $this->addColumn('carrier', 'Carrier', 'VARCHAR', true, 45, null);
    59:         $this->addForeignKey('status_id', 'StatusId', 'INTEGER', 'order_status', 'id', false, null, null);
    60:         $this->addColumn('lang', 'Lang', 'VARCHAR', true, 10, null);
    61:         $this->addColumn('created_at', 'CreatedAt', 'TIMESTAMP', false, null, null);
    62:         $this->addColumn('updated_at', 'UpdatedAt', 'TIMESTAMP', false, null, null);
    63:         // validators
    64:     } // initialize()
    65:
    66:     /**
    67:      * Build the RelationMap objects for this table relationships
    68:      */
    69:     public function buildRelations()
    70:     {
    71:         $this->addRelation('Currency', 'Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), 'SET NULL', 'RESTRICT');
    72:         $this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
    73:         $this->addRelation('OrderAddressRelatedByAddressInvoice', 'Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('address_invoice' => 'id', ), 'SET NULL', 'RESTRICT');
    74:         $this->addRelation('OrderAddressRelatedByAddressDelivery', 'Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('address_delivery' => 'id', ), 'SET NULL', 'RESTRICT');
    75:         $this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::MANY_TO_ONE, array('status_id' => 'id', ), 'SET NULL', 'RESTRICT');
    76:         $this->addRelation('OrderProduct', 'Thelia\\Model\\OrderProduct', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'OrderProducts');
    77:         $this->addRelation('CouponOrder', 'Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'CouponOrders');
    78:     } // buildRelations()
    79:
    80:     /**
    81:      *
    82:      * Gets the list of behaviors registered for this table
    83:      *
    84:      * @return array Associative array (name => parameters) of behaviors
    85:      */
    86:     public function getBehaviors()
    87:     {
    88:         return array(
    89:             'timestampable' =>  array (
    90:   'create_column' => 'created_at',
    91:   'update_column' => 'updated_at',
    92:   'disable_updated_at' => 'false',
    93: ),
    94:         );
    95:     } // getBehaviors()
    96:
    97: } // OrderTableMap
    98: