Comments (5)
yiisoft/yii2/db/BaseActiveRecord.php
What version of yii are you using? Line 81 of 2.16.1 looks like this:
if ($lock !== null && !$rows) {
Can you try it on 2.16.1 without breaking your project?
Can you think of a test I could do to verify the behavior you want is working?
from yii2-relation-trait.
Thank you for your help, unfortunately, I still have the problem also with v 2.16.1
`
Stale Object Exception – yii\db\StaleObjectException
The object being updated is outdated.
1. in C:\Users\none\work\rebase\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 813
804805806807808809810811812813814815816817818819820821822
if ($lock !== null) {
$values[$lock] = $this->$lock + 1;
$condition[$lock] = $this->$lock;
}
// We do not check the return value of updateAll() because it's possible
// that the UPDATE statement doesn't change anything and thus returns 0.
$rows = static::updateAll($values, $condition);
if ($lock !== null && !$rows) {
throw new StaleObjectException('The object being updated is outdated.');
}
if (isset($values[$lock])) {
$this->$lock = $values[$lock];
}
$changedAttributes = [];
foreach ($values as $name => $value) {
$changedAttributes[$name] = isset($this->_oldAttributes[$name]) ? $this->_oldAttributes[$name] : null;
`
error_log dump:
- $lock = db_lock (this is my lock column name)
- $rows = 0
the comment of the BaseActiveRecord is like this:
// We do not check the return value of updateAll() because it's possible // that the UPDATE statement doesn't change anything and thus returns 0. $rows = static::updateAll($values, $condition);
But why should this condition ($lock is the column name && no updates) throws an error?
from yii2-relation-trait.
Anybody got any idea where is the problem? :-(
from yii2-relation-trait.
@strtob I don't know the cause yet. I've setup a test harness to run an x-debug trace on my database.
Thanks for the information you have sent so far. I will let you know what I find.
from yii2-relation-trait.
Thank you :-)
from yii2-relation-trait.
Related Issues (20)
- loadAll() returns false if no relation in post() HOT 21
- record deleted immediately after insert HOT 8
- Too few arguments to function app\models\base\Dokter::getListDokterRS(), 0 passed and exactly 1 expected HOT 5
- ArgumentCountError Too few arguments to function app\models\base\Poli::getListPoli(), 0 passed and exactly 1 expected
- Error : Too few arguments to function app\models\base\Penilaian::getPenilaianDetsWithParam(), 0 passed and exactly 1 expected
- Unable to locate message source for category 'mtrelt'. HOT 2
- $notDeletedPK - ID's of models came null
- Filtered record being deleted on update HOT 8
- Can't save hasMany relation without index 0 (zero)
- Deletion of has many relation works wrong HOT 1
- update failed with no relation HOT 1
- $this->relatedRecords is empty HOT 1
- working with Taggable Behavior
- ID column for Related model doesn't populate on Post
- AR Method afterSave() of related model will be marked as deleted HOT 1
- This extension is pure shit and should be deleted !!! HOT 2
- Feature Request: softDelete()
- deleteWithRelated only works with direct relations
- SaveAll() function Deletes Related Records unexpectedly. HOT 1
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 yii2-relation-trait.