question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] [Have a solution] Attribute mutators doesnt work with Translatable entity when its empty Relation subfield in Relationship field

See original GitHub issue

Bug 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

tans3

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:closed
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
pxpmcommented, Jul 8, 2022

Indeed, can you add your review there @maurohmartinez ? We close this after @tabacitu merges the other PR.

1reaction
pxpmcommented, May 25, 2022

Ahh ok, get it. Thanks for clarification.

I will have a look at it.

Thanks @guleswine

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found