doctrine / DoctrineBundle

Symfony Bundle for Doctrine ORM and DBAL
https://www.doctrine-project.org/projects/doctrine-bundle.html
MIT License
4.71k stars 450 forks source link

Notice: Trying to get property of non-object #795

Closed methodeprog closed 6 years ago

methodeprog commented 6 years ago

Dear Sir i use v2.6.1 and 2.7.x-dev

image

And in the vendor this

image

I dont know why this error in line 3325

                    $fieldMapping['columnName'],
                    $this->reflClass->name,
                    $embeddable->reflClass->name
mikeSimonson commented 6 years ago

Hi,

Thank for the bug repport. What are you doing that triggers that error ?

methodeprog commented 6 years ago

I ve tried symfony Command make:crud just to generate a crud of an Entity and i get In ClassMetadataInfo.php line 3325 Notice: Trying to get property of non-object

////////////////////////////////////////////////////////////////////// For example : echo $user->name; // Trying to get property of non-object So if we we try to know more about this $user var_dump($user); // array(2) [] Its not an object echo $user->name; // Will give a bug Source: https://www.grafikart.fr/formations/deboguer-code-php/property-of-non-object ///////////////////////////////////////////////////////////////// First i ve tried to check my code, but first i mention that the error show me In ClassMetadataInfo.php line 3325

Thats why a open this issue perhaps something wrong on these lines...

mikeSimonson commented 6 years ago

We need the version of symfony and the doctrineBundle that you use and the entity that you passed as a parameter to give you any information on what went wrong but it's most likely not related to the classMetadata.

methodeprog commented 6 years ago

I use version Symfony 4.0.6 / doctrineBundle 2.7.x-dev / I use this command to generate an crud for my entity and sure the entity is clean : php bin/console make : crud so perhaps its in my code

weaverryan commented 6 years ago

@methodeprog I think you should re-open this issue on https://github.com/symfony/maker-bundle, as the make:crud command comes from that bundle.

But, we will also need more information. The BEST thing would be the exact code of the entity that you are trying to generate the crud for and any mapping data if you use XML or YAML for entity mapping.

kimhemsoe commented 6 years ago

Closing for now as "not a doctrine bundle issue"