Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Bug #561: Fix `ActiveRecordInterface::upsert()` with `$updateProperties = false` (@Tigrov)
- Bug #550: Relation query should be created by related class, not primary model class (@batyrmastyr)
- Enh #571: Optimize performance of `ActiveRecord::get()` method (@Tigrov)
- Enh #575: Remove check for empty string in `AbstractActiveRecord::markPropertyChanged()` method (@Tigrov)

## 1.0.2 March 11, 2026

Expand Down
2 changes: 1 addition & 1 deletion src/AbstractActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function link(string $relationName, ActiveRecordInterface $linkModel, arr

public function markPropertyChanged(string $name): void
{
if ($this->oldValues !== null && $name !== '') {
if ($this->oldValues !== null) {
unset($this->oldValues[$name]);
}
}
Expand Down
10 changes: 10 additions & 0 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,16 @@ public function testMarkPropertyChanged(): void
$this->assertSame($expectedAffectedRows, $affectedRows);
}

public function testMarkPropertyChangedWithEmptyName()
{
$model = new NullValues();
$model->assignOldValues(['' => 'empty name', 'name' => 'Vasya']);

$model->markPropertyChanged('');

$this->assertSame(['name' => 'Vasya'], $model->oldValues());
}

public function testResetsIntermediateViaRelationWhenLinkPropertyChanges(): void
{
$order = OrderWithCustomerProfileViaCustomerRelation::query()->findByPk(1);
Expand Down