Skip to content

Instantly share code, notes, and snippets.

@Dramacydal
Created September 7, 2017 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dramacydal/3b998031a4cae06c6a4076c3257c4b1f to your computer and use it in GitHub Desktop.
Save Dramacydal/3b998031a4cae06c6a4076c3257c4b1f to your computer and use it in GitHub Desktop.
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