private function createColumnsAndValues (&$exclude)
	{
		
		// If there is no primary key value exclude it (i.e assume auto increment)
		
		if (!$this->attributeHasValue (static::$pk))
		{
			$exclude[]	= static::$pk;
		}
		
		// Set column and value variables

		$columns	= NULL;
		$values		= NULL;
		
		// Loop through attributes
		
		foreach (static::$attributes as $name => $attribute)
		{
			
			// If we're excluding the attribute then move on
			
			if (in_array ($name, $exclude))
			{
				continue;
			}
			
			// If the attribute is not set
			
			if (!$this->attributeIsset ($name))
			{
				
				// If there is a default set it
				
				if (array_key_exists ('default', $attribute))
				{
					$this->iset ($name, $attribute['default'], FALSE);
				}
				
				// Else if the attribute can be set to NULL then do so
				
				else if (isset ($attribute['null']) && $attribute['null'])
				{
					$this->iset ($name, NULL, FALSE);
				}
				
				// Else set a blank value
				
				else
				{
					$this->iset ($name, '', FALSE);
				}
				
			}
			
			// Add the column and values
			
			$columns	.= ', `' . $name . '`';
			$values		.= ', ' . $this->transformValue ($name, $attribute, $exclude);
			
		}
		
		// Trim the first character (,) from the column and values
		
		$columns	= substr ($columns, 2);
		$values		= substr ($values, 2);
		
		// Return columns and values
		
		return array (
			'columns'	=> $columns,
			'values'	=> $values
		);
		
	}
private function createColumnsAndValues (&$exclude)
	{
		
		// If there is no primary key value exclude it (i.e assume auto increment)
		
		if (!$this->attributeHasValue (static::$pk))
		{
			$exclude[]	= static::$pk;
		}
		
		// Set column and value variables

		$columns	= NULL;
		$values		= NULL;
		
		// Loop through attributes
		
		foreach (static::$attributes as $name => $attribute)
		{
			
			// If we're excluding the attribute then move on
			
			if (in_array ($name, $exclude))
			{
				continue;
			}
			
			// If the attribute is not set
			
			if (!$this->attributeIsset ($name))
			{
				
				// If there is a default set it
				
				if (array_key_exists ('default', $attribute))
				{
					$this->iset ($name, $attribute['default'], FALSE);
				}
				
				// Else if the attribute can be set to NULL then do so
				
				else if (isset ($attribute['null']) && $attribute['null'])
				{
					$this->iset ($name, NULL, FALSE);
				}
				
				// Else set a blank value
				
				else
				{
					$this->iset ($name, '', FALSE);
				}
				
			}
			
			// Add the column and values
			
			$columns	.= ', `' . $name . '`';
			$values		.= ', ' . $this->transformValue ($name, $attribute, $exclude);
			
		}
		
		// Trim the first character (,) from the column and values
		
		$columns	= substr ($columns, 2);
		$values		= substr ($values, 2);
		
		// Return columns and values
		
		return array (
			'columns'	=> $columns,
			'values'	=> $values
		);
		
	}
private function createColumnsAndValues ( & $ exclude ) { // If there is no primary key value exclude it (i.e assume auto increment) if ( ! $ this -> attributeHasValue ( static :: $ pk ) ) { $ exclude [ ] = static :: $ pk ; } // Set column and value variables $ columns = NULL ; $ values = NULL ; // Loop through attributes foreach ( static :: $ attributes as $ name => $ attribute ) { // If we're excluding the attribute then move on if ( in_array ( $ name , $ exclude ) ) { continue ; } // If the attribute is not set if ( ! $ this -> attributeIsset ( $ name ) ) { // If there is a default set it if ( array_key_exists ( 'default' , $ attribute ) ) { $ this -> iset ( $ name , $ attribute [ 'default' ] , FALSE ) ; } // Else if the attribute can be set to NULL then do so else if ( isset ( $ attribute [ 'null' ] ) && $ attribute [ 'null' ] ) { $ this -> iset ( $ name , NULL , FALSE ) ; } // Else set a blank value else { $ this -> iset ( $ name , '' , FALSE ) ; } } // Add the column and values $ columns .= ', `' . $ name . '`' ; $ values .= ', ' . $ this -> transformValue ( $ name , $ attribute , $ exclude ) ; } // Trim the first character (,) from the column and values $ columns = substr ( $ columns , 2 ) ; $ values = substr ( $ values , 2 ) ; // Return columns and values return array ( 'columns' => $ columns , 'values' => $ values ) ; }
Generate create query columns and values
@param array $exclude Attribute exclusion array
@return array ('columns', 'values')
Generate create query columns and values