src/mako/database/midgard/ORM.php
protected function insertRecord(Query $query): void
	{
		if($this->primaryKeyType === static::PRIMARY_KEY_TYPE_INCREMENTING)
		{
			$this->columns[$this->primaryKey] = $query->insertAndGetId($this->columns, $this->primaryKey);
		}
		else
		{
			switch($this->primaryKeyType)
			{
				case static::PRIMARY_KEY_TYPE_UUID:
					$this->columns[$this->primaryKey] = UUID::v4();
					break;
				case static::PRIMARY_KEY_TYPE_CUSTOM:
					$this->columns[$this->primaryKey] = $this->generatePrimaryKey();
					break;
			}

			$query->insert($this->columns);
		}
	}
protected function insertRecord(Query $query): void
	{
		if($this->primaryKeyType === static::PRIMARY_KEY_TYPE_INCREMENTING)
		{
			$this->columns[$this->primaryKey] = $query->insertAndGetId($this->columns, $this->primaryKey);
		}
		else
		{
			switch($this->primaryKeyType)
			{
				case static::PRIMARY_KEY_TYPE_UUID:
					$this->columns[$this->primaryKey] = UUID::v4();
					break;
				case static::PRIMARY_KEY_TYPE_CUSTOM:
					$this->columns[$this->primaryKey] = $this->generatePrimaryKey();
					break;
			}

			$query->insert($this->columns);
		}
	}
protected function insertRecord ( Query $ query ) : void { if ( $ this -> primaryKeyType === static :: PRIMARY_KEY_TYPE_INCREMENTING ) { $ this -> columns [ $ this -> primaryKey ] = $ query -> insertAndGetId ( $ this -> columns , $ this -> primaryKey ) ; } else { switch ( $ this -> primaryKeyType ) { case static :: PRIMARY_KEY_TYPE_UUID : $ this -> columns [ $ this -> primaryKey ] = UUID :: v4 ( ) ; break ; case static :: PRIMARY_KEY_TYPE_CUSTOM : $ this -> columns [ $ this -> primaryKey ] = $ this -> generatePrimaryKey ( ) ; break ; } $ query -> insert ( $ this -> columns ) ; } }
Inserts a new record into the database.

@param \mako\database\midgard\Query $query Query builder
Inserts a new record into the database .