original_string: private function insert($validate = true)
  	{
  		$this->verifyNotReadonly('insert');
  
  		// Check if validation or beforeCreate returns false.
  		if (($validate && !$this->_validate() || !$this->invokeCallback('beforeCreate',false))) {
  			return false;
  		}
  
  		$table = static::table();
  
  		// Get dirty attributes, or when nothing is dirty we just take all atrributes
  		if (!($attributes = $this->dirtyAttributes())) { 
  			$attributes = $this->_attributes;
  		}
  
  		$pk = $this->getPrimaryKey(true);
  		$useSequence = false;
  
  		if ($table->sequence && !isset($attributes[$pk]))
  		{
  			if (($conn = static::connection()) instanceof OciAdapter) {
  
  				// terrible oracle makes us select the nextval first
  				$attributes[$pk] = $conn->getNextSequenceValue($table->sequence);
  				$table->insert($attributes);
  				$this->_attributes[$pk] = $attributes[$pk];
  				
  			} else {
  				// unset pk that was set to null
  				if (array_key_exists($pk, $attributes)) {
  					unset($attributes[$pk]);
  				}
  
  				$table->insert($attributes, $pk, $table->sequence);
  				$useSequence = true;
  			}
  		} else {
  
  			// Simple insert
  			$table->insert($attributes);
  
  		}
  			
  
  		// if we've got an autoincrementing/sequenced pk set it
  		// don't need this check until the day comes that we decide to support composite pks
  		// if (count($pk) == 1)
  		{
  			$column = $table->getColumnByInflectedName($pk);
  
  			if ($column->autoIncrement || $useSequence) {
  				$this->_attributes[$pk] = static::connection()->insertId($table->sequence);
  			}
  		}
  
  		$this->_newRecord = false;
  		$this->invokeCallback('afterCreate', false);
  		return true;
  	}
code: private function insert($validate = true)
  	{
  		$this->verifyNotReadonly('insert');
  
  		// Check if validation or beforeCreate returns false.
  		if (($validate && !$this->_validate() || !$this->invokeCallback('beforeCreate',false))) {
  			return false;
  		}
  
  		$table = static::table();
  
  		// Get dirty attributes, or when nothing is dirty we just take all atrributes
  		if (!($attributes = $this->dirtyAttributes())) { 
  			$attributes = $this->_attributes;
  		}
  
  		$pk = $this->getPrimaryKey(true);
  		$useSequence = false;
  
  		if ($table->sequence && !isset($attributes[$pk]))
  		{
  			if (($conn = static::connection()) instanceof OciAdapter) {
  
  				// terrible oracle makes us select the nextval first
  				$attributes[$pk] = $conn->getNextSequenceValue($table->sequence);
  				$table->insert($attributes);
  				$this->_attributes[$pk] = $attributes[$pk];
  				
  			} else {
  				// unset pk that was set to null
  				if (array_key_exists($pk, $attributes)) {
  					unset($attributes[$pk]);
  				}
  
  				$table->insert($attributes, $pk, $table->sequence);
  				$useSequence = true;
  			}
  		} else {
  
  			// Simple insert
  			$table->insert($attributes);
  
  		}
  			
  
  		// if we've got an autoincrementing/sequenced pk set it
  		// don't need this check until the day comes that we decide to support composite pks
  		// if (count($pk) == 1)
  		{
  			$column = $table->getColumnByInflectedName($pk);
  
  			if ($column->autoIncrement || $useSequence) {
  				$this->_attributes[$pk] = static::connection()->insertId($table->sequence);
  			}
  		}
  
  		$this->_newRecord = false;
  		$this->invokeCallback('afterCreate', false);
  		return true;
  	}
code_tokens: private function insert ( $ validate = true ) { $ this -> verifyNotReadonly ( 'insert' ) ; // Check if validation or beforeCreate returns false. if ( ( $ validate && ! $ this -> _validate ( ) || ! $ this -> invokeCallback ( 'beforeCreate' , false ) ) ) { return false ; } $ table = static :: table ( ) ; // Get dirty attributes, or when nothing is dirty we just take all atrributes if ( ! ( $ attributes = $ this -> dirtyAttributes ( ) ) ) { $ attributes = $ this -> _attributes ; } $ pk = $ this -> getPrimaryKey ( true ) ; $ useSequence = false ; if ( $ table -> sequence && ! isset ( $ attributes [ $ pk ] ) ) { if ( ( $ conn = static :: connection ( ) ) instanceof OciAdapter ) { // terrible oracle makes us select the nextval first $ attributes [ $ pk ] = $ conn -> getNextSequenceValue ( $ table -> sequence ) ; $ table -> insert ( $ attributes ) ; $ this -> _attributes [ $ pk ] = $ attributes [ $ pk ] ; } else { // unset pk that was set to null if ( array_key_exists ( $ pk , $ attributes ) ) { unset ( $ attributes [ $ pk ] ) ; } $ table -> insert ( $ attributes , $ pk , $ table -> sequence ) ; $ useSequence = true ; } } else { // Simple insert $ table -> insert ( $ attributes ) ; } // if we've got an autoincrementing/sequenced pk set it // don't need this check until the day comes that we decide to support composite pks // if (count($pk) == 1) { $ column = $ table -> getColumnByInflectedName ( $ pk ) ; if ( $ column -> autoIncrement || $ useSequence ) { $ this -> _attributes [ $ pk ] = static :: connection ( ) -> insertId ( $ table -> sequence ) ; } } $ this -> _newRecord = false ; $ this -> invokeCallback ( 'afterCreate' , false ) ; return true ; }
docstring: Issue an INSERT sql statement for this model's attribute.
  
  @see save
  @param boolean $validate Set to true or false depending on if you want the validators to run or not
  @return boolean True if the model was saved to the database otherwise false
docstring_tokens: Issue an INSERT sql statement for this model s attribute .