Combine table fields in templates

@Howan Ingo Polster
Tue, 03 Sep 2024 17:12:51 +0000

Hey Kevin, thank you so much.
That worked so far and i understood the Virtual Fields.

Im still not sure how to proceed.

protected function _getFullAdress()
    {
        return $this->street . '  ' . $this->house_no . ' ' . $this->postcode . ' ' . $this->city;
    }

When i want to just show the Virtual Field i can simply

$user->house->full_adress

But when i want to show it in the EDIT or NEW i was struggeling what to do.

  echo $this->Form->control('house_id', [
                        'options' => $houses,

The only way i found was to set the DisplayField to my created Virtual Field

$this->setDisplayField('full_adress');

Is that the way you would do that?