-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidatorException on Doctrine Proxy (Auto Validation Mapping?) #31715
Comments
Same for me, recently upgraded to 4.3.0, form with a EntityType, for now on, the properties of these entity must be public to avoid this exception?!? |
Did you enable the new |
It happens without enabling |
For me, auto_mapping was already enabled without any issues prior to 4.3.0 |
I can't find any docs on how this new feature is enabled/disabled; the only
This was auto-generated when first creating the project using Symfony 4.2.2. |
I mean the new |
I have not set it, and it isn't present in the config files (my Running
|
#31749 is a first steps which at least ensures that auto mapping is not enabled by default. Though that doesn't fix the core issue with Doctrine proxies. |
…apping by default (xabbuh) This PR was merged into the 4.3 branch. Discussion ---------- [DoctrineBridge][Validator] do not enable validator auto mapping by default | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | part of #31715, #31752 | License | MIT | Doc PR | Commits ------- a3555fc do not enable validator auto mapping by default
Hello, it seems I have this exception as well. But with embedded doctrine entity. I have Embeddable entity I think it is because of autovalidating a length of column, since both // Foo
/**
* @ORM\Column(type="string", length=100)
*
* @var string
*/
private $one; |
@MortalFlesh it seems that Nicolas Grekas is already on it - in the meantime try setting this in your framework config:
|
@fabstei @MortalFlesh I have the same issue with embedded entities in a Symfony 4.3 migration Unfortunately, using The auto_mapper is always being registered by the doctrine-bundle, not sure how the auto_mapping param affects the registration: EDIT: this works for me: |
I'm also seeing this error in Symfony 4.3.0. The property it's complaining about is definitely in the entity. The property is defined as '@Orm\Column(type="string", length=100, nullable=true, unique=true)' Same as above, settings the auto_mapping property does not resolve this. I'm also seeing a similar issue with inherited entities i.e. I have an entity class extending another - it's unable to access properties of the base class. |
I have the same issue with the following field definition:
|
Can one of you create an example application that allows to reproduce? |
Thanks that seems to have worked for me; framework.yaml
|
@pulsesalessolutions This works for me also! |
Facing same issue after submitting a form. Mapping on my entity:
Error I get after submitting the form: |
@guillaumesmo's solution works for me too:
I have some Doctrine entities with inheritance, and in forms for derived entities I got this "property does not exist" problem for properties of base classes since 4.3, as already described by others. I don't know how and why, but |
This also affects third party bundles like |
Can you check if #31836 finally solves this issue? |
…rent class (xabbuh) This PR was merged into the 4.3 branch. Discussion ---------- [DoctrineBridge] do not process private properties from parent class | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31715, #31752 | License | MIT | Doc PR | Commits ------- adfa1ef do not process private properties from parent class
@xabbuh that fixed the problem indeed, no need to the auto_mapping param anymore Thank you |
@guillaumesmo Thank you very much for the feedback. |
I'm not sure that this issue is actually fixed. The problem in the first place was that Doctrine's proxy class was being used instead of the actual entity class. The related PRs don't seem to address that problem, but merely avoiding it. |
@teohhanhui If I don't miss anything, the issue was that the |
It was registering But I thought a Doctrine proxy class would fail this check: symfony/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php Lines 49 to 53 in b7366a2
|
The fact that the feature was enabled by default was another bug fixed in #31749. |
@xabbuh I know, but what I was trying to say is that, the bug shouldn't exist according to my logic above, but it does. Which means that my understanding was wrong, which means that we didn't get to the root of the problem, and maybe the bug is still not fixed... |
I think I do not really understand the issue then. Could you create a small example application that allows to reproduce this? |
Symfony version(s) affected:
4.3 (Beta2 & RC1)
Description
Handling a request with a form that has an assigned Entity seems to wrongly trigger a ValidatorException.
How to reproduce
My apologies for the missing reproducer - I'm having issues creating it. since 4.3.0-RC1 is affected I thought sharing even without one could help.
triggers
in PropertyMetadata.php#L39-L41
The stacktrace is here: https://gist.github.com/fabstei/ee254c7945ebc79fd3fed75cf4de82db
Possible Solution
None so far. After uncommenting PropertyMetadata.php#L39-L41 everything works as expected, but it's obviously not a solution.
Additional context
The text was updated successfully, but these errors were encountered: