Doctrine / Symphony: Entity with Non-Displayable Property

How to add a property to an Entity class that should not appear in the database?

I need a property for a temporary value. Therefore, the property should not be retrieved from the database or stored in it. it also should not be a sql calculated value, I need to install (and get) this only in PHP code.

+5
source share
1 answer

Writing a property without annotation should not be associated with your database as an example of a User object.

 class User { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="array") */ protected $username; protected $notPersistedProperty } 

Hope this helps.

+16
source

Source: https://habr.com/ru/post/1215552/


All Articles