# File core/lib/Thelia/Model/map/OrderTableMap.php | thelia

     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('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
    90:         );
    91:     } // getBehaviors()
    92:
    93: } // OrderTableMap
    94: