summaryrefslogtreecommitdiff
path: root/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Service/Spec/CustomFieldSpec.php
blob: 2c68934426fae6579671f242f515f253c3056ca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php

namespace Civi\Api4\Service\Spec;

class CustomFieldSpec extends FieldSpec {
  /**
   * @var int
   */
  protected $customFieldId;

  /**
   * @var int
   */
  protected $customGroup;

  /**
   * @var string
   */
  protected $tableName;

  /**
   * @var string
   */
  protected $columnName;

  /**
   * @inheritDoc
   */
  public function setDataType($dataType) {
    switch ($dataType) {
      case 'ContactReference':
        $this->setFkEntity('Contact');
        $dataType = 'Integer';
        break;

      case 'File':
      case 'StateProvince':
      case 'Country':
        $this->setFkEntity($dataType);
        $dataType = 'Integer';
        break;
    }
    return parent::setDataType($dataType);
  }

  /**
   * @return int
   */
  public function getCustomFieldId() {
    return $this->customFieldId;
  }

  /**
   * @param int $customFieldId
   *
   * @return $this
   */
  public function setCustomFieldId($customFieldId) {
    $this->customFieldId = $customFieldId;

    return $this;
  }

  /**
   * @return int
   */
  public function getCustomGroupName() {
    return $this->customGroup;
  }

  /**
   * @param string $customGroupName
   *
   * @return $this
   */
  public function setCustomGroupName($customGroupName) {
    $this->customGroup = $customGroupName;

    return $this;
  }

  /**
   * @return string
   */
  public function getCustomTableName() {
    return $this->tableName;
  }

  /**
   * @param string $customFieldColumnName
   *
   * @return $this
   */
  public function setCustomTableName($customFieldColumnName) {
    $this->tableName = $customFieldColumnName;

    return $this;
  }

  /**
   * @return string
   */
  public function getCustomFieldColumnName() {
    return $this->columnName;
  }

  /**
   * @param string $customFieldColumnName
   *
   * @return $this
   */
  public function setCustomFieldColumnName($customFieldColumnName) {
    $this->columnName = $customFieldColumnName;

    return $this;
  }

}