How can I add a property to an Entity
Class, which should not be mapped to the database?
I need the property for a temporary value. Therefore the property should not be fetched from or persisted to the database. it neither should be a sql-calculated value, i need to set (and get) this within php code only.
Writing a property without annotation should not be linked to your Database as example of an entity User.
class User
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="array")
*/
protected $username;
protected $notPersistedProperty
}
Hope this helped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With