mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge remote-tracking branch 'upstream/develop' into 4.3
Conflicts: composer.json user_guide_src/source/models/model.rst
This commit is contained in:
commit
376b34a84b
5
.github/workflows/test-autoreview.yml
vendored
5
.github/workflows/test-autoreview.yml
vendored
@ -30,13 +30,12 @@ jobs:
|
||||
coverage: none
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composercache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composercache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
|
5
.github/workflows/test-coding-standards.yml
vendored
5
.github/workflows/test-coding-standards.yml
vendored
@ -36,13 +36,12 @@ jobs:
|
||||
coverage: none
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.php-version }}-
|
||||
|
10
.github/workflows/test-deptrac.yml
vendored
10
.github/workflows/test-deptrac.yml
vendored
@ -43,16 +43,12 @@ jobs:
|
||||
run: composer validate --strict
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create composer cache directory
|
||||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
|
||||
|
||||
- name: Cache composer dependencies
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
|
10
.github/workflows/test-phpstan.yml
vendored
10
.github/workflows/test-phpstan.yml
vendored
@ -50,16 +50,12 @@ jobs:
|
||||
run: composer validate --strict
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create composer cache directory
|
||||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
|
||||
|
||||
- name: Cache composer dependencies
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
|
5
.github/workflows/test-phpunit.yml
vendored
5
.github/workflows/test-phpunit.yml
vendored
@ -141,13 +141,12 @@ jobs:
|
||||
sudo apt-get install --fix-broken
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composercache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composercache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
|
10
.github/workflows/test-rector.yml
vendored
10
.github/workflows/test-rector.yml
vendored
@ -59,16 +59,12 @@ jobs:
|
||||
run: composer validate --strict
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create composer cache directory
|
||||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
|
||||
|
||||
- name: Cache composer dependencies
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
|
@ -270,7 +270,7 @@
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $headers = $request->getHeaders(); ?>
|
||||
<?php $headers = $request->headers(); ?>
|
||||
<?php if (! empty($headers)) : ?>
|
||||
|
||||
<h3>Headers</h3>
|
||||
@ -318,7 +318,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php $headers = $response->getHeaders(); ?>
|
||||
<?php $headers = $response->headers(); ?>
|
||||
<?php if (! empty($headers)) : ?>
|
||||
<?php natsort($headers) ?>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
"phpstan/phpstan": "^1.7.1",
|
||||
"phpunit/phpunit": "^9.1",
|
||||
"predis/predis": "^1.1 || ^2.0",
|
||||
"rector/rector": "0.14.5",
|
||||
"rector/rector": "0.14.6",
|
||||
"vimeo/psalm": "^4.26"
|
||||
},
|
||||
"suggest": {
|
||||
|
@ -473,7 +473,7 @@ trait ResponseTrait
|
||||
header(sprintf('HTTP/%s %s %s', $this->getProtocolVersion(), $this->getStatusCode(), $this->getReasonPhrase()), true, $this->getStatusCode());
|
||||
|
||||
// Send all of our headers
|
||||
foreach (array_keys($this->getHeaders()) as $name) {
|
||||
foreach (array_keys($this->headers()) as $name) {
|
||||
header($name . ': ' . $this->getHeaderLine($name), false, $this->getStatusCode());
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
echo $response->getStatusCode();
|
||||
echo $response->getBody();
|
||||
echo $response->getHeader('Content-Type');
|
||||
echo $response->header('Content-Type');
|
||||
$language = $response->negotiateLanguage(['en', 'fr']);
|
||||
|
@ -4,6 +4,6 @@
|
||||
echo $response->getHeaderLine('Content-Type');
|
||||
|
||||
// Get all headers
|
||||
foreach ($response->getHeaders() as $name => $value) {
|
||||
foreach ($response->headers() as $name => $value) {
|
||||
echo $name . ': ' . $response->getHeaderLine($name) . "\n";
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
if (strpos($response->getHeader('content-type'), 'application/json') !== false) {
|
||||
if (strpos($response->header('content-type'), 'application/json') !== false) {
|
||||
$body = json_decode($body);
|
||||
}
|
||||
|
@ -319,14 +319,18 @@ Saving Data
|
||||
insert()
|
||||
--------
|
||||
|
||||
An associative array of data is passed into this method as the only parameter to create a new
|
||||
row of data in the database. The array's keys must match the name of the columns in a ``$table``, while
|
||||
the array's values are the values to save for that key:
|
||||
The first parametre is an associative array of data to create a new row of data in the database.
|
||||
If an object is passed instead of an array, it will attempt to convert it to an array.
|
||||
|
||||
.. literalinclude:: model/015.php
|
||||
The array's keys must match the name of the columns in the ``$table``, while the array's values are the values to save for that key.
|
||||
|
||||
The optional second parameter is of type boolean, and if it is set to false, the method will return a boolean value,
|
||||
which indicates the success or failure of the query.
|
||||
|
||||
You can retrieve the last inserted row's primary key using the ``getInsertID()`` method.
|
||||
|
||||
.. literalinclude:: model/015.php
|
||||
|
||||
.. _model-allow-empty-inserts:
|
||||
|
||||
allowEmptyInserts()
|
||||
|
@ -5,4 +5,11 @@ $data = [
|
||||
'email' => 'd.vader@theempire.com',
|
||||
];
|
||||
|
||||
// Inserts data and returns inserted row's primary key
|
||||
$userModel->insert($data);
|
||||
|
||||
// Inserts data and returns true on success and false on failure
|
||||
$userModel->insert($data, false);
|
||||
|
||||
// Returns inserted row's primary key
|
||||
$userModel->getInsertID();
|
||||
|
Loading…
x
Reference in New Issue
Block a user