<?php

App::uses('Model', 'Model');

/**
 * Application model for Cake.
 *
 * Add your application-wide methods in the class below, your models
 * will inherit them.
 *
 * @package       app.Model
 */

class ConsumerOrder extends AppModel {
	public $belongsTo = array(
		'User' => array('className' => 'User', 'foreignKey' => 'user_id', 'fields' => array('first_name', 'last_name','name'), 'type'=>'inner'),
		'Consumer' => array('className' => 'Consumer', 'foreignKey' => 'consumer_id', 'fields' => array('id', 'first_name','last_name','name'), 'type'=>'inner'),
	);
	
	public $hasMany = array(
		'ConsumerSale' => array(
            'className' => 'ConsumerSale',
            'foreignKey' => 'consumer_order_id',
			'dependent' => true
        ),
        'ConsumerFreeItem' => array(
            'className' => 'ConsumerFreeItem',
            'foreignKey' => 'consumer_order_id',
			'dependent' => true
        ),      
        
    );
}