return new FieldCollection([ (new IdField('id', 'id'
))->
addFlags(new PrimaryKey(),
new Required()),
(new FkField('locale_id', 'localeId', LocaleDefinition::
class))->
addFlags(new Required()),
(new StringField('username', 'username'
))->
addFlags(new Required(),
new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING
)),
(new PasswordField('password', 'password', \PASSWORD_DEFAULT,
[], PasswordField::FOR_ADMIN
))->
removeFlag(ApiAware::
class)->
addFlags(new Required()),
(new StringField('first_name', 'firstName'
))->
addFlags(new Required(),
new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING
)),
(new StringField('last_name', 'lastName'
))->
addFlags(new Required(),
new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING
)),
(new StringField('title', 'title'
))->
addFlags(new SearchRanking(SearchRanking::MIDDLE_SEARCH_RANKING
)),
(new StringField('email', 'email'
))->
addFlags(new Required(),
new SearchRanking(SearchRanking::HIGH_SEARCH_RANKING
)),
new BoolField('active', 'active'
),
new BoolField('admin', 'admin'
),
new DateTimeField('last_updated_password_at', 'lastUpdatedPasswordAt'
),
(new TimeZoneField('time_zone', 'timeZone'
))->
addFlags(new Required()),
new CustomFields(),
new ManyToOneAssociationField('locale', 'locale_id', LocaleDefinition::
class, 'id', false
),
new FkField('avatar_id', 'avatarId', MediaDefinition::
class),
new ManyToOneAssociationField('avatarMedia', 'avatar_id', MediaDefinition::
class),
(new OneToManyAssociationField('media', MediaDefinition::
class, 'user_id'
))->
addFlags(new SetNullOnDelete()),
(new OneToManyAssociationField('accessKeys', UserAccessKeyDefinition::
class, 'user_id', 'id'
))->
addFlags(new CascadeDelete()),
(new OneToManyAssociationField('configs', UserConfigDefinition::
class, 'user_id', 'id'
))->
addFlags(new CascadeDelete()),
new OneToManyAssociationField('stateMachineHistoryEntries', StateMachineHistoryDefinition::
class, 'user_id', 'id'
),
(new OneToManyAssociationField('importExportLogEntries', ImportExportLogDefinition::
class, 'user_id', 'id'
))->
addFlags(new SetNullOnDelete()),
new ManyToManyAssociationField('aclRoles', AclRoleDefinition::
class, AclUserRoleDefinition::
class, 'user_id', 'acl_role_id'
),