src/console/shipyard.php
public function action_model( $params ) 
	{	
		$options = \CCDataObject::assign( $params );
		
		// params
		$name = $options->get( 0, null );
		$table = $options->get( 1, null );
		
		// get name if we dont have one
		while( !$name ) 
		{
			$name = $this->read( 'Please enter the class name: ' );
		}
		
		// get table if we dont have one
		while( !$table ) 
		{
			$table = $this->read( 'Please enter the table name: ' );
		}
		
		// resolve the path
		if ( !$path = \CCPath::classes( str_replace( '_', '/', $name ), EXT ) )
		{
			$this->error( 'Could not resolve the path. Check if the namespace is registered.' ); return;
		}
		
		// create the class
		$model = \CCShipyard::create( 'dbmodel', $name, $table );
		
		// auto timestamps
		$model->timestamps( $options->get( 'timestamps', false ) );
		
		// check before
		if ( file_exists( $path ) )
		{
			if ( !CCCli::confirm( "The class already exists. Do you wish to overwrite it?", true ) ) 
			{
				return;
			}
		}
		
		// write file
		\CCFile::write( $path, $model->output() );
	}
public function action_model( $params ) 
	{	
		$options = \CCDataObject::assign( $params );
		
		// params
		$name = $options->get( 0, null );
		$table = $options->get( 1, null );
		
		// get name if we dont have one
		while( !$name ) 
		{
			$name = $this->read( 'Please enter the class name: ' );
		}
		
		// get table if we dont have one
		while( !$table ) 
		{
			$table = $this->read( 'Please enter the table name: ' );
		}
		
		// resolve the path
		if ( !$path = \CCPath::classes( str_replace( '_', '/', $name ), EXT ) )
		{
			$this->error( 'Could not resolve the path. Check if the namespace is registered.' ); return;
		}
		
		// create the class
		$model = \CCShipyard::create( 'dbmodel', $name, $table );
		
		// auto timestamps
		$model->timestamps( $options->get( 'timestamps', false ) );
		
		// check before
		if ( file_exists( $path ) )
		{
			if ( !CCCli::confirm( "The class already exists. Do you wish to overwrite it?", true ) ) 
			{
				return;
			}
		}
		
		// write file
		\CCFile::write( $path, $model->output() );
	}
public function action_model ( $ params ) { $ options = \ CCDataObject :: assign ( $ params ) ; // params $ name = $ options -> get ( 0 , null ) ; $ table = $ options -> get ( 1 , null ) ; // get name if we dont have one while ( ! $ name ) { $ name = $ this -> read ( 'Please enter the class name: ' ) ; } // get table if we dont have one while ( ! $ table ) { $ table = $ this -> read ( 'Please enter the table name: ' ) ; } // resolve the path if ( ! $ path = \ CCPath :: classes ( str_replace ( '_' , '/' , $ name ) , EXT ) ) { $ this -> error ( 'Could not resolve the path. Check if the namespace is registered.' ) ; return ; } // create the class $ model = \ CCShipyard :: create ( 'dbmodel' , $ name , $ table ) ; // auto timestamps $ model -> timestamps ( $ options -> get ( 'timestamps' , false ) ) ; // check before if ( file_exists ( $ path ) ) { if ( ! CCCli :: confirm ( "The class already exists. Do you wish to overwrite it?" , true ) ) { return ; } } // write file \ CCFile :: write ( $ path , $ model -> output ( ) ) ; }
generate a model class

exmample:
run shipyard::model <class>
run shipyard::model <class> <table>
run shipyard::model <namespace>::<class>

@param array 		$params
@return void
generate a model class