Created
September 7, 2017 10:47
-
-
Save Dramacydal/3b998031a4cae06c6a4076c3257c4b1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getMap() | |
{ | |
return [ | |
self::FIELD__ID => [ | |
'getter' => 'getId', | |
'setter' => 'setId', | |
'role' => [ | |
self::ROLE__PRIMARY_KEY => true, | |
self::ROLE__GENERATE_KEY => true, | |
], | |
'name' => 'Id', | |
'description' => 'Contract ID', | |
'type' => 'string', | |
'formType' => 'text', | |
'validator' => [ | |
[ | |
'type' => 'type.check', | |
'data' => [ | |
'type' => 'string' | |
] | |
], | |
[ | |
'type' => 'string.byRegex', | |
'data' => [ | |
'pattern' => '/^[0-9a-f]{32}$/i' | |
] | |
] | |
], | |
'options' => [ | |
'required' => false, | |
'unique' => true, | |
], | |
], | |
self::FIELD__PARENT_CONTRACT => [ | |
'getter' => 'getParentContractId', | |
'setter' => 'setParentContractId', | |
'name' => 'Parent contract', | |
'description' => 'Parent contract', | |
'type' => 'string', | |
'formType' => 'select', | |
'validator' => [ | |
[ | |
'type' => 'type.check', | |
'data' => [ | |
'type' => 'string' | |
] | |
], | |
[ | |
'type' => 'string.byRegex', | |
'data' => [ | |
'pattern' => '/^[0-9a-f]{32}$/i' | |
] | |
] | |
], | |
'relations' => [ | |
'parentContract' => [ | |
'getter' => 'getParentContract', | |
'setter' => 'setParentContract', | |
'type' => self::RELATION__ONE_TO_ONE, | |
'mapper' => contractMapper::class, | |
] | |
], | |
'options' => [ | |
'required' => false, | |
'unique' => false, | |
], | |
], | |
self::FIELD__NUMBER => [ | |
'getter' => 'getNumber', | |
'setter' => 'setNumber', | |
'role' => [ | |
self::ROLE__TITLE => true, | |
self::ROLE__SEARCHABLE => true, | |
self::ROLE__SORTABLE => true, | |
self::ROLE__QUERY_FIELD => true, | |
], | |
'name' => 'Number', | |
'description' => 'Contract number', | |
'type' => 'string', | |
'formType' => 'text', | |
'validator' => [ | |
[ | |
'type' => 'type.check', | |
'data' => [ | |
'type' => 'string' | |
] | |
] | |
], | |
'options' => [ | |
'required' => true, | |
'unique' => true, | |
], | |
], | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment