FriendsOfAkeneo / CustomEntityBundle

Eases the creation of custom entity and related views in the PIM
Other
53 stars 61 forks source link

Modify values before save - Alter values at background #183

Closed nilamrz closed 6 years ago

nilamrz commented 6 years ago

Hi,

My custom entity is having 3 fields

1. Name
2. Code
3. Label

When saving I will only set Name and I will need save in db as follwing:

Code = Name + "XX"
Label = "Label : " + Name

Is there any way to achieve this?

Thanks.

mmetayer commented 6 years ago

Hello @nilamrz, you can modify a field before saving by implementing an EventSubscriber (see here), or by using lifecycle callbacks (see here). I'll close this issue as it is not directly related to the CustomEntityBundle, feel free to reopen it if you think I was wrong :)

Regards, Mathias