Location: PHPKode > projects > Php simple acces data mysql > phpsimpledb_v2/manage/projets/generation/templates-files/collection.class.php
<?php
//recherche la clee primaire
$sPrimaryKey = '';
foreach( $oObject->oFields as $oField )
	if( $oField->sKey == 'PRI' ){
		$sPrimaryKey = $oField->sName;
	}
$sData = '<?php
	class PHPSIMPLEDB_collection_'.$oObject->sName.' extends PHPSIMPLEDB_extends_collection{
		
		var $_oPHPSIMPLEDB = NULL;
		var $_oInfos = array( \'table\' => \''.$oObject->sTable.'\', \'primarykey\' => \''.$sPrimaryKey.'\', \'name\' => \''.$oObject->sName.'\', \'tagname\' => \''.$oObject->sTagname.'\', \'desc\' => \''.$oObject->sDesc.'\' );
		var $_oFields = array('."\n";

foreach( $oObject->oFields as $oField ){
	$sType = $oField->sType;
	$sSize = 'NULL';
	$iPos_start = stripos( $sType, '(' );
	if( $iPos_start !== false ){
		$iPos_stop = stripos( $sType, ')' );
		$sSize = substr( $sType, $iPos_start + 1, $iPos_stop - ( $iPos_start + 1 ) );
		$sType = substr( $sType, 0, $iPos_start );
	}
	$sData .= '			\''.$oField->sName.'\'=>array( \'typefield\' => \''.$oField->sTypeField.'\', \'linkobject\' => \''.$oField->sLinkObject.'\', \'name\' => \''.$oField->sName.'\', \'type\' => \''.$sType.'\',\'size\' => '.$sSize.', \'key\' => \''.$oField->sKey.'\', \'interclassement\' => \''.$oField->sInterclassement.'\', \'attributs\' => \''.$oField->sAttributs.'\', \'null\' => \''.$oField->sNull.'\', \'defaut\' => \''.$oField->sDefaut.'\', \'extra\' => \''.$oField->sExtra.'\', \'value\' => NULL ),'."\n";
}
$sData = rtrim( $sData, ','."\n" );
$sData .= ' );

		/** Constructeur de '.$oObject->sName.' */
		public function __construct( $oPHPSIMPLEDB ){
			$this->_oPHPSIMPLEDB = $oPHPSIMPLEDB;
		}
	}
?>';
?>
Return current item: Php simple acces data mysql