for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace keeko\core\validator;
use keeko\framework\validator\ModelValidator;
use keeko\framework\preferences\SystemPreferences;
class UserValidator extends ModelValidator {
protected function getValidations() {
$prefs = $this->service->getPreferenceLoader()->getSystemPreferences();
$validations = [];
if ($prefs->getUserLogin() != SystemPreferences::LOGIN_EMAIL) {
$validations[] = [
'constraint' => 'notnull',
'column' => 'user_name'
];
}
if ($prefs->getUserEmail() || $prefs->getUserLogin() != SystemPreferences::LOGIN_USERNAME) {
'constraint' => 'email',
'column' => 'email'
if ($prefs->getUserNames()) {
'column' => 'given_name'
'column' => 'family_name'
if ($prefs->getUserBirth()) {
'constraint' => 'required',
'column' => 'birth'
if ($prefs->getUserSex()) {
'constraint' => 'choice',
'column' => 'sex',
'choices' => [0, 1]
return $validations;