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();
    }
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();
    }
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 ( ) ; }
Inserts a new row into database returns insertId

@param array $data
@param string $table
@return int|null
Inserts a new row into database returns insertId