(NFC) (dev/core#878) Simplify copyright header (Civi/*)
[civicrm-core.git] / Civi / Api4 / Service / Spec / CustomFieldSpec.php
CommitLineData
19b53e5b
C
1<?php
2
380f3545
TO
3/*
4 +--------------------------------------------------------------------+
41498ac5 5 | Copyright CiviCRM LLC. All rights reserved. |
380f3545 6 | |
41498ac5
TO
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
380f3545
TO
10 +--------------------------------------------------------------------+
11 */
12
13/**
14 *
15 * @package CRM
ca5cec67 16 * @copyright CiviCRM LLC https://civicrm.org/licensing
380f3545
TO
17 * $Id$
18 *
19 */
20
21
19b53e5b
C
22namespace Civi\Api4\Service\Spec;
23
24class CustomFieldSpec extends FieldSpec {
25 /**
26 * @var int
27 */
28 protected $customFieldId;
29
30 /**
31 * @var int
32 */
33 protected $customGroup;
34
35 /**
36 * @var string
37 */
38 protected $tableName;
39
40 /**
41 * @var string
42 */
43 protected $columnName;
44
45 /**
46 * @inheritDoc
47 */
48 public function setDataType($dataType) {
49 switch ($dataType) {
50 case 'ContactReference':
51 $this->setFkEntity('Contact');
52 $dataType = 'Integer';
53 break;
54
55 case 'File':
56 case 'StateProvince':
57 case 'Country':
58 $this->setFkEntity($dataType);
59 $dataType = 'Integer';
60 break;
61 }
62 return parent::setDataType($dataType);
63 }
64
65 /**
66 * @return int
67 */
68 public function getCustomFieldId() {
69 return $this->customFieldId;
70 }
71
72 /**
73 * @param int $customFieldId
74 *
75 * @return $this
76 */
77 public function setCustomFieldId($customFieldId) {
78 $this->customFieldId = $customFieldId;
79
80 return $this;
81 }
82
83 /**
84 * @return int
85 */
86 public function getCustomGroupName() {
87 return $this->customGroup;
88 }
89
90 /**
91 * @param string $customGroupName
92 *
93 * @return $this
94 */
95 public function setCustomGroupName($customGroupName) {
96 $this->customGroup = $customGroupName;
97
98 return $this;
99 }
100
101 /**
102 * @return string
103 */
104 public function getCustomTableName() {
105 return $this->tableName;
106 }
107
108 /**
109 * @param string $customFieldColumnName
110 *
111 * @return $this
112 */
113 public function setCustomTableName($customFieldColumnName) {
114 $this->tableName = $customFieldColumnName;
115
116 return $this;
117 }
118
119 /**
120 * @return string
121 */
122 public function getCustomFieldColumnName() {
123 return $this->columnName;
124 }
125
126 /**
127 * @param string $customFieldColumnName
128 *
129 * @return $this
130 */
131 public function setCustomFieldColumnName($customFieldColumnName) {
132 $this->columnName = $customFieldColumnName;
133
134 return $this;
135 }
136
137}