Maslosoft / Mangan

MongoDB Object Persister/ODM
https://maslosoft.com/mangan/
Other
5 stars 0 forks source link

Create Immutable Validator #80

Closed pmaselkowski closed 7 years ago

pmaselkowski commented 7 years ago

This validator should prevent changing property if it's already saved and param to check against (defaults to itself) is trueish. Example: Prevent changing name if set:

@ImmutableValidator
$name = ''

Prevent changing name if installed:

@ImmutableValidator(against = 'installed')
$name = ''
$installed = false

NOTE: This need to check if model is saved, and if saved value to check against of should be taken from db too.