Skip to content

Commit 3a2d51a

Browse files
committed
去掉属性器定义 避免和关联定义冲突
1 parent f392b5c commit 3a2d51a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/model/concern/Attribute.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,7 @@ private function setWithAttr(string $name, $value, array $data = [])
471471
{
472472
$attr = Str::studly($name);
473473
$method = 'set' . $attr . 'Attr';
474-
if (method_exists($this, $attr) && $set = $this->$attr()['set'] ?? '') {
475-
$value = $set($value, $data);
476-
} elseif (method_exists($this, $method)) {
474+
if (method_exists($this, $method)) {
477475
$value = $this->$method($value, $data);
478476
} else {
479477
// 类型转换
@@ -571,9 +569,6 @@ private function getWithAttr(string $name, $value, array $data = [])
571569
if ($withAttr) {
572570
// 动态获取器
573571
$value = $withAttr($value, $data, $this);
574-
} elseif (method_exists($this, $attr) && $get = $this->$attr()['get'] ?? '') {
575-
// 属性器
576-
$value = $get($value, $data);
577572
} elseif (method_exists($this, $method)) {
578573
// 获取器
579574
$value = $this->$method($value, $data);

src/model/concern/OptimLock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait OptimLock
2222
{
2323
protected function getOptimLockField()
2424
{
25-
return $this->getOption('optim_lock_field') ?? 'lock_version';
25+
return $this->getOption('optimLock') ?? 'lock_version';
2626
}
2727

2828
/**

0 commit comments

Comments
 (0)