How do I create a "write once" field in Doctrine or Symfony?

How do I create a "write once" field in Doctrine or Symfony?

I’m trying to have some entities that have a created DateTime field, but I only want it to be settable when the entity is initially created but somehow define a rule that it can’t be changed after the entity is created.

Is there any way to define this type of constraint either in Symfony constraints or Doctrine?

Source: Symfony Questions

Leave a Reply

Your email address will not be published. Required fields are marked *