[Bug] [Have a solution] Attribute mutators doesnt work with Translatable entity when its empty Relation subfield in Relationship field
See original GitHub issueBug report
I wrote about this comment, but for reliability, I will duplicate it. It seems to me that this is a rather serious problem for those who use translatable models.
What I did
Make model MultipleEventResponse
public $translatable = ['text'];
public function setTextAttribute($value){ //its just simple example
if ($value!=null){
$this->attributes['text'] = $value;
}
}
Make reationship field in parent entity controller Multiple Event
public function responses()
{
return $this->hasMany(MultipleEventResponse::class);
}
CRUD::addField([ // relationship
'label'=>'Answers',
'type' => "relationship",
'name' => 'responses',
'subfields' => [
[
'label'=>'Question',
'name' => 'text',
'type' => 'textarea',
'wrapper' => [
'class' => 'form-group col-md-3',
],
],
What I expected to happen
save empty value
What happened
What I’ve already tried to fix it
no idea
Backpack, Laravel, PHP, DB version
PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) Copyright © The PHP Group Zend Engine v4.1.2, Copyright © Zend Technologies with Zend OPcache v8.1.2, Copyright ©, by Zend Technologies
LARAVEL VERSION:
v9.11.0@598a8c84d452a66b90a3213b1d67189cc726c728
BACKPACK VERSION:
5.0.15@ec24c10ff3ee69cf0aafef9f16ec1d90c9ba9d7a
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Laravel 9 Mutating Attribute not returning mutated attribute
Initially the source code was from laravel version 5 and someone upgraded to 9. Update 2. All my setters are working, but only...
Read more >Apache OpenJPA User's Guide
The JPA Overview describes the fundamentals of the JPA specification. The OpenJPA Reference Guide contains detailed documentation on all aspects of OpenJPA.
Read more >BackpackForLaravel/Lobby - Gitter
Hi all, I'm going crazy as I had a branch that worked with Laravel Backpack and Spatie MediaLibrary and now it's not working...
Read more >Programming Plone - The MySite Tutorial - CiteSeerX
This is why it is not easy to have referable objects and robust relationship management within plain Zope. When programming Plone, it is...
Read more >Programming Abstractions in C++
they were trying to compute and have the computer itself translate those formulas into ... To get around this problem, C++ defines three...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Indeed, can you add your review there @maurohmartinez ? We close this after @tabacitu merges the other PR.
Ahh ok, get it. Thanks for clarification.
I will have a look at it.
Thanks @guleswine