You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to validate computed field that is referenced as title below. The field's content is built from parts of two other entities ([entity1]Document->getName and [entity2]DocumentRevision->getRevisionNmber).
Main issue is that although UniqeEntity constraint is used on the title field and modification is done on PRE_SUBMIT or on POST_SET_DATA (and validation should be performed on SUBMIT event SonataAdmin does not return form validation error, but tries to enter data to the database invoking DB layer error on Unique constraint.
Second issue is that I can't/dont know how to get data of related entities (to generate the title field name) as using callbacks to entity cause errors (running method on non object).
Also this issue seems to be related to #1016 about EventSubscriber.
If there is a different way to keep fields validated and make them computed at runtime please let me know I'm very eager to know of a way (with details please).
The text was updated successfully, but these errors were encountered:
It can be closed. I have used LifecycleCallbacks and for some reason it works :-). I am trying to do the same now for other Entity, but it's not working as expected.
PS. this should work on DB level not on Form level as I want this to functionality to work even when I'm not using form directly (or through a factory).
I am trying to validate computed field that is referenced as
title
below. The field's content is built from parts of two other entities ([entity1]Document->getName and [entity2]DocumentRevision->getRevisionNmber).Main issue is that although UniqeEntity constraint is used on the title field and modification is done on PRE_SUBMIT or on POST_SET_DATA (and validation should be performed on SUBMIT event SonataAdmin does not return form validation error, but tries to enter data to the database invoking DB layer error on Unique constraint.
Second issue is that I can't/dont know how to get data of related entities (to generate the
title
field name) as using callbacks to entity cause errors (running method on non object).For more details please refer to this topic on stack overflow: http://stackoverflow.com/questions/25135031/symfony-2-change-entitys-field-from-admin-while-keeping-validation-using-sona
Also this issue seems to be related to #1016 about EventSubscriber.
If there is a different way to keep fields validated and make them computed at runtime please let me know I'm very eager to know of a way (with details please).
The text was updated successfully, but these errors were encountered: