[Solar-talk] Auto Creating databases in Solar

Kilbride, James P. James.Kilbride at gd-ais.com
Tue Jan 15 12:57:51 CST 2008


That's a really good comment. That should be added to the documentation
or mentioned in one of the wiki tutorials. Good catch Raymond. Thanks.
 
James Kilbride

________________________________

From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Raymond
Kolbe
Sent: Tuesday, January 15, 2008 1:53 PM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Auto Creating databases in Solar


For a list of reserved words, look at Solar_Sql_Reserved. Comment is one
of them.


On Jan 15, 2008 1:49 PM, Raymond Kolbe <rkolbe at gmail.com> wrote: 


	( 'comment' => array ( 0 => 'ERR_IDENTIFIER_RESERVED', 1 => 
	array ( 'type' => 'column', 'name' => 'comment', ), ),
	
	
	Looks like 'comment' is a reserved word. Try changing that to
something else and auto create should work. 


	On Jan 15, 2008 1:22 PM, Walker, Jason T.
<Jason.Walker at gd-ais.com> wrote:
	

		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
		
		_______________________________________________
		Solar-talk mailing list
		Solar-talk at lists.solarphp.com
		http://mailman-mail3.webfaction.com/listinfo/solar-talk 
		



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20080115/53c97ab3/attachment-0001.html


More information about the Solar-talk mailing list