Insert new snippet

@param array $data Snippet data
@return Garp_Db_Table_Row
428509
protected function _create(array $data) {
        $this->_validateLoadable();
        $snippetModel = new Model_Snippet();
        try {
            $snippetID = $snippetModel->insert($data);
            $snippet = $snippetModel->fetchRow(
                $snippetModel->select()->where('id = ?', $snippetID)
            );
            return $snippet;
        } catch (Garp_Model_Validator_Exception $e) {
            Garp_Cli::errorOut($e->getMessage());
        }
    }
309596
public function insert($table, $data)
    {
        $query = $this->provider->buildInsertQuery($table, $data);

        return $this->provider->query($query, null);
    }
578062
public function insert($table, array $data)
    {
        $table = $this->getTable($table);
        $field = implode(', ', array_keys($data));

        $placeholder = array();
        foreach ($data as $key => $value) {
            if ($value instanceof \stdClass && isset($value->scalar)) {
                $placeholder[] = $value->scalar;
                unset($data[$key]);
            } else {
                $placeholder[] = '?';
            }
        }
        $placeholder = implode(', ', $placeholder);

        $query = "INSERT INTO $table ($field) VALUES ($placeholder)";
        return $this->executeUpdate($query, array_values($data));
    }
1341657
public function insert($data)
    {
        if(empty($data))
            throw new Exception("Can't insert an empty row");

        return $this->_connection->execute(sprintf(
            'INSERT INTO %s SET %s',
            $this->_name->quoted(),
            $this->_buildSet($data)
            ), array_values($data)
        );
    }
1131829
public function add($data = [])
    {
        $insertId = $this->db->insert($data)->into($this->table)->execute(FALSE);

        return $insertId;
    }
865736
public function insertData($data)
    {

        try {
            $location1 = new Order();
            $location1->order_no = $data['order_no'];
            $location1->order_desc = $data['order_desc'];
            $location1->full_address = $data['full_address'];
            $location1->user_id = $data['user_id'];
            $location1->user_name = $data['user_name'];
            $location1->user_mobile = $data['user_mobile'];
            $location1->merchant_id = $data['merchant_id'];
            $location1->merchant_name = $data['merchant_name'];
            $location1->merchant_tel = $data['merchant_tel'];
            $location1->published_at = $data['published_at'];
            $location1->user_lat = $data['user_lat'];
            $location1->user_lng = $data['user_lng'];
            $location1->geom = new GeomPoint($data['user_lng'], $data['user_lat']);
            $location1->big_cat = isset($data['big_cat']) ? $data['big_cat'] : '';
            $location1->middle_cat = isset($data['middle_cat']) ? $data['middle_cat'] : '';
            $location1->small_cat = isset($data['small_cat']) ? $data['small_cat'] : '';
            $location1->order_type = isset($data['order_type']) ? $data['order_type'] :0;
            $location1->biz_type = isset($data['biz_type']) ? $data['biz_type'] : 0;
            $location1->save();
        } catch (\Exception $e) {
            Log::info('c=OrderApiRepository f=insertData  msg=' . $e->getMessage());
            return false;
        }
        return $location1->getQueueableId();

    }
1179172
public function insertNewRecord($data) {

        $emailMessage = new Email_message;

        $emailMessage->user_id             = $data['user_id'];
        $emailMessage->priority_id         = $data['priority_id'];
        $emailMessage->from_email_address  = $data['from_email_address'];
        $emailMessage->from_name           = $data['from_name'];
        $emailMessage->to_email_address    = $data['to_email_address'];
        $emailMessage->to_name             = $data['to_name'];
        $emailMessage->subject             = $data['subject'];
        $emailMessage->slug                = $data['slug'];
        $emailMessage->body                = $data['body'];
        $emailMessage->sent                = $data['sent'];
        $emailMessage->sent_timestamp      = $data['sent_timestamp'];
        $emailMessage->read                = $data['read'];
        $emailMessage->archived            = $data['archived'];
        $emailMessage->created_at          = $data['created_at'];
        $emailMessage->created_by          = $data['created_by'];
        $emailMessage->updated_at          = $data['updated_at'];
        $emailMessage->updated_by          = $data['updated_by'];

        if ($emailMessage->save()) {

            // Return the new ID
            return $emailMessage->id;
        }

        return false;
    }
1079841
public function createNewRecord($data) {
        $list_email = new $this->model;

        $list_email->title      = $data['list_id']." ".$data['email_id'];
        $list_email->list_id    = $data['list_id'];
        $list_email->email_id   = $data['email_id'];
        $list_email->comments   = $data['comments'];
        $list_email->enabled    = $data['enabled'];
        $list_email->created_at = $data['created_at'];
        $list_email->created_by = $data['created_by'];
        $list_email->updated_at = $data['updated_at'];
        $list_email->updated_by = $data['updated_by'];
        $list_email->locked_at  = null;
        $list_email->locked_by  = null;

        if ($list_email->save()) {

            // Return the new ID
            return $list_email->id;
        }

        return false;
    }
889946
public static function insertIgnore(array $data)
    {
        if (empty($data)) {
            return false;
        }

        // Case where $data is not an array of arrays.
        if (!isset($data[0])) {
            $data = [$data];
        }

        $sql = static::buildInsertIgnoreSql($data);

        $data = static::inLineArray($data);

        return self::getModelConnectionName()->affectingStatement($sql, $data);
    }
166843
public function insert($data) {
        if ($data instanceof Record) {
            $data = clone $data;
        } else {
            $data = new Record(Utils::toArray($data));
        }
        return $this->getFormat()->insert($data);
    }
77197
public function create(array $data)
    {
        // Creates the keys string
        $keys = implode(', ', array_keys($data));

        // Creates the values string
        $values = implode('", "', $data);

        // Creates the query with the $data array keys & values
        $query = 'INSERT INTO ' . $this->table . ' (' . $keys . ') VALUES ("' . $values . '")';

        // Executes the query
        $this->database->action($query);
    }
858671
private function genInsert(array $data): string
    {
        // Current table
        $table = $this->getCollection();

        // Generate array of fields for insert
        $fieldNames = implode(',', array_keys($data));

        // Generate line with data for update
        $fieldDetails = ':' . implode(', :', array_keys($data));

        return "INSERT INTO $table ($fieldNames) VALUES ($fieldDetails)";
    }
882338
public function create_sql_insert_string(array $data) {
		#$retval = "";
		if(is_array($data) && count($data)) {
			$fields = "";
			$values = "";
			foreach($data as $k=>$v) {
				$fields = ToolBox::create_list($fields, $k, ", ");
				$values = ToolBox::create_list($values, ':'. $k, ", ");
			}
			if(strlen($fields) && strlen($values)) {
				$retval = ' ('. $fields .') VALUES ('. $values .')';
			}
			else {
				throw new Exception(__METHOD__ .": no fields (". $fields .") or values (". $values .") created... ". $this->gfObj->debug_print($data,0));
			}
		}
		else {
			throw new Exception(__METHOD__ .": unable to create insert string, no fields given");
		}
		
		return($retval);
	}
1211230
public function insert(array $data): int
    {
        $this->builder->setInsertData($data);
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->execSql($sql);
    }
461001
public function insert(array $data)
    {
        $id = 0;
        if (!empty($data['task_id'])) {
            $id = (int) $data['task_id'];
            $resource = 'todo_items';
        } elseif (!empty($data['project_id'])) {
            $id = (int) $data['project_id'];
            $resource = 'projects';
        }
        if ($id <= 0) {
            throw new Exception('Required field project_id or task_id');
        }
        return $this->rest->post("$resource/$id/$this->action", $data);
    }
1273011
public function rowsFromRaw($data)
	{
		$rows = new Rows;

		if ($data && count($data) > 0)
		{
			foreach ($data as $row)
			{
				$rows->push(self::newFromResults($row));
			}
		}

		return $rows;
	}
873476
public function insert(array $data, $table = null)
    {
        $table = ($table) ?: $this->getTable();
        $sql = $this->getSql();
        $insert = $sql->insert($table);

        $insert->values($data);

        $statement = $sql->prepareStatementForSqlObject($insert);
        $result = $statement->execute();

        return $result->getGeneratedValue();
    }