handle beforeMarshal little better
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 4m14s
CI / testsuite (mysql, 8.4, ) (push) Has started running
CI / testsuite (pgsql, 8.2, ) (push) Has started running
CI / testsuite (pgsql, 8.4, ) (push) Has started running
CI / testsuite (sqlite, 8.2, ) (push) Has been cancelled
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Has been cancelled
CI / testsuite (sqlite, 8.4, ) (push) Has been cancelled
CI / Coding Standard & Static Analysis (push) Has been cancelled
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 4m14s
CI / testsuite (mysql, 8.4, ) (push) Has started running
CI / testsuite (pgsql, 8.2, ) (push) Has started running
CI / testsuite (pgsql, 8.4, ) (push) Has started running
CI / testsuite (sqlite, 8.2, ) (push) Has been cancelled
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Has been cancelled
CI / testsuite (sqlite, 8.4, ) (push) Has been cancelled
CI / Coding Standard & Static Analysis (push) Has been cancelled
This commit is contained in:
@@ -175,11 +175,11 @@ class AddressesTable extends Table {
|
||||
* @return void
|
||||
*/
|
||||
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void {
|
||||
if ($data['state_id'] && !isset($data['state'])) {
|
||||
if (($data['state_id'] ?? false) && !isset($data['state'])) {
|
||||
$state = $this->States->find()->where(['id' => $data['state_id']])->first();
|
||||
$data['state'] = $state->name ?? null;
|
||||
}
|
||||
if ($data['country_id'] && !isset($data['country'])) {
|
||||
if (($data['country_id'] ?? false) && !isset($data['country'])) {
|
||||
$country = $this->Countries->find()->where(['id' => $data['country_id']])->first();
|
||||
$data['country'] = $country->name ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user