[Solar-talk] Auto Creating databases in Solar

Walker, Jason T. Jason.Walker at gd-ais.com
Tue Jan 15 12:22:52 CST 2008


Trying to create a new table called customer using Solar framework and
ran into this error:  

Fatal error: Uncaught exception
'Solar_Controller_Page_Exception_DuringFetch' class::code
'CAMIS_App_test::ERR_DURING_FETCH' with message 'Exception encountered
in the fetch() method.' information array ( 'exception' =>
Solar_Sql_Adapter_Exception_TableNotCreated::__set_state(array( '_info'
=> array ( 'comment' => array ( 0 => 'ERR_IDENTIFIER_RESERVED', 1 =>
array ( 'type' => 'column', 'name' => 'comment', ), ), '__table' =>
'shipping', ), '_class' => 'Solar_Sql_Adapter_Mysql', 'message' =>
'ERR_TABLE_NOT_CREATED', 'string' => '', 'code' =>
'ERR_TABLE_NOT_CREATED', 'file' => 'C:\\Solar\\Solar-0.28.0\\Solar.php',
'line' => 363, 'trace' => array ( 0 => array ( 'file' =>
'C:\\Solar\\Solar-0.28.0\\Solar.php', 'line' => 558, 'function' =>
'factory', 'class' => 'Solar', 'type' => '::', 'args' => array ( 0 =>
'Sol in C:\Solar\Solar-0.28.0\Solar.php on line 363

My question is what change needs to be made in my model, so that it auto
creates the table?  See code below.  Thanks



<?php

class CAMIS_Models_Customer extends Solar_Sql_Model {
	/** class name should be same as file name
	 * Model Setup for Inventory Table setup for CAMIS
	 *
	 */

	protected function _setup() {
		/*The Shipping Asset Table */
		$this->_table_name = 'customer';
		
		 /* The columns in our posts table */
        $this->_table_cols = array(
            
            'customer_id' => array(
                'type'    => 'int',
                'require' => true,
                'primary' => true,
                'autoinc' => true,
            ),
            'name' => array(
            	'type'	=>'varchar',
            	'size'	=> 150,            	
            	'require' => true,
            ),
            
            
        );
            
           
        // This row contains all shipping asset which have a container
id
        //equal to the rows primary key
        $this->_hasMany('receivers', array(
            'foreign_class' => 'CAMIS_Models_Shipping',
            'foreign_key'   => 'receiver_id',
        ));
        
        $this->_hasMany('shippers', array(
            'foreign_class' => 'CAMIS_Models_Shipping',
            'foreign_key'   => 'shipper_id',
        ));
        
        $this->_hasMany('pos', array(
            'foreign_class' => 'CAMIS_Models_ProcessingOrder',
            'foreign_key'   => 'customer_id',
        ));

	}
	
}
?>
		

Jason	 



More information about the Solar-talk mailing list