Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

'Cannot access uninitialized non-nullable property' on symfony/var-exporter 6.3.9 #52839

Copy link
Copy link
Closed as not planned
@stephanvierkant

Description

@stephanvierkant
Issue body actions

Symfony version(s) affected

6.3.9, 6.4.0

Description

As of Symfony/var-exporter 6.3.9 I've got this error message on multiple places in my application:

Cannot access uninitialized non-nullable property App\Entity\User::$notifications by reference

It happens when I get an Organization from Doctrine.

My entity:

#[\ApiPlatform\Metadata\ApiResource(
    // ...
)]
#[\Doctrine\ORM\Mapping\Entity(UserRepository::class)]
class User
{
    #[ManyToOne(Organisation::class, cascade: ['persist'], inversedBy: 'users')]
    #[Gedmo\Versioned]
    private ?Organisation $organisation = null;

    #[OneToMany('user', targetEntity: \App\Entity\User\Notification::class)]
    private Collection $notifications;
    public function __construct()
    {
        $this->notifications = new ArrayCollection();
    }
}

How to reproduce

I'll create a reproducer if necessary, but before I do I'd like to hear some feedback. Maybe it's a simple mistake I've made, or someone has some suggestions how to create a reproducer.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.