Get values from relationship properties.

I have a form where I have a fieldset of a relationship. I would like to know if there's a way I can get these values inside the handleRecordUpdate method. I don't want it to save the relationship automatically because it has to go through the repository first. Thanks
7 Replies
Patrick Boivin
I you're using handleRecordUpdate(), I think the fieldset data should be in the $data parameter, try dd($data)
joao nivaldo
joao nivaldoOP2y ago
Yes, they are, but the relationship data that is inside the Field does not come with it
Patrick Boivin
I think I don't fully understand... can you show me the code for the fieldset and what you are missing in $data? Doh, ok I think I get it. Read the relationship from $this->data instead of $data
joao nivaldo
joao nivaldoOP2y ago
Using $this->data worked, it showed the values of the relationship. So I have a question. When I use $this->data is it already serialized after validation?
Patrick Boivin
Maybe someone else can confirm but no, I think $this->data is the raw data, before validation
joao nivaldo
joao nivaldoOP2y ago
I don't think so either, but it's good to be sure. I'll wait until someone else speaks. But thanks for the tip
awcodes
awcodes2y ago
$this->form->getState() will get the data and run the validations.
Want results from more Discord servers?
Add your server