Comments (3)
Cannot reproduce with CI 4.5.1 or 4.4.8.
I see int(5)
:
public function testInsertID(): void
{
$data = [
'name' => 'Apprentice',
'description' => 'That thing you do.',
];
$this->createModel(JobModel::class);
$this->model->protect(false)->save($data);
$lastInsertId = $this->model->getInsertID();
var_dump($lastInsertId); exit;
$this->seeInDatabase('job', ['id' => $lastInsertId]);
}
from codeigniter4.
The work around we are currently having to use is
to check if we have an primary key id, then calling the insert or update function separately which works fine.
I don't know why the workaround is needed, because it is what the save() method does:
CodeIgniter4/system/BaseModel.php
Lines 742 to 759 in c66cae8
from codeigniter4.
We use GitHub issues to track BUGS and to track approved DEVELOPMENT work packages. We use our forum to provide SUPPORT and to discuss FEATURE REQUESTS.
from codeigniter4.
Related Issues (20)
- Bug: [CURLRequest] Setting default Content-Type in HTTP\Response cause to multiple headers in response HOT 1
- Bug: form_open with no URL supplied HOT 2
- Bug: `service('example')` null return if service is defined in the custom namespace in Manual Installation CI4.5.0 HOT 2
- Official User Guide is not updated HOT 1
- Bug: [Postgre] Unable to connect to the database HOT 5
- Bug: Failed to open stream: No such file or directory (root/index.php) HOT 4
- Bug: [QueryBuilder] join() with BETWEEN causes TypeError preg_quote(): Argument #1 ($str) must be of type string, false given HOT 7
- Bug: redirect()->back() caching issue HOT 2
- Bug: CI4 + Shield + Postgre Spark error HOT 3
- Bug: bootstrap on `preload` not updated to last v4.5.1 HOT 1
- Bug: [ErrorException] Undefined array key "opcache.enable" HOT 1
- Bug: [Model] when the query ($this->first()) result returns NULL we get TypeError HOT 2
- Bug: [OCI8] Argument #1 ($value) must be of type ?int, string given HOT 2
- Bug: Invalid date format for ORACLE database for created_at and updated_at HOT 2
- Bug: Entity::$dataCaster must not be accessed before initialization HOT 1
- How to add CI4 in a raw project and use the database class? HOT 2
- Bug: calling force_https() in 404 controller causes error HOT 8
- The lang function exposes the name of your language file if there is no record. HOT 1
- Bug: Error when run php spark cmd in testing env HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter4.