Issues (3627)

bundles/PluginBundle/Entity/IntegrationEntity.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\PluginBundle\Entity;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\ORM\Mapping as ORM;
16
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
17
use Mautic\CoreBundle\Entity\CommonEntity;
18
19
/**
20
 * Class Plugin.
21
 */
22
class IntegrationEntity extends CommonEntity
23
{
24
    /**
25
     * @var int
26
     */
27
    private $id;
28
29
    /**
30
     * @var string
31
     */
32
    private $integration;
33
34
    /**
35
     * @var string
36
     */
37
    private $integrationEntity;
38
39
    /**
40
     * @var string
41
     */
42
    private $integrationEntityId;
43
44
    /**
45
     * @var \DateTime
46
     */
47
    private $dateAdded;
48
49
    /**
50
     * @var \DateTime
51
     */
52
    private $lastSyncDate;
53
54
    /**
55
     * @var string
56
     */
57
    private $internalEntity;
58
59
    /**
60
     * @var int
61
     */
62
    private $internalEntityId;
63
64
    /**
65
     * @var array
66
     */
67
    private $internal;
68
69
    /**
70
     * IntegrationEntity constructor.
71
     */
72
    public function __construct()
73
    {
74
        $this->internal = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new Doctrine\Common\Collections\ArrayCollection() of type Doctrine\Common\Collections\ArrayCollection is incompatible with the declared type array of property $internal.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
75
    }
76
77
    public static function loadMetadata(ORM\ClassMetadata $metadata)
78
    {
79
        $builder = new ClassMetadataBuilder($metadata);
80
81
        $builder->setTable('integration_entity')
82
            ->setCustomRepositoryClass(IntegrationEntityRepository::class)
83
            ->addIndex(['integration', 'integration_entity', 'integration_entity_id'], 'integration_external_entity')
84
            ->addIndex(['integration', 'internal_entity', 'internal_entity_id'], 'integration_internal_entity')
85
            ->addIndex(['integration', 'internal_entity', 'integration_entity'], 'integration_entity_match')
86
            ->addIndex(['integration', 'last_sync_date'], 'integration_last_sync_date')
87
            ->addIndex(['internal_entity_id', 'integration_entity_id', 'internal_entity', 'integration_entity'], 'internal_integration_entity');
88
89
        $builder->addId();
90
91
        $builder->addDateAdded();
92
93
        $builder->addNullableField('integration', 'string');
94
95
        $builder->createField('integrationEntity', 'string')
96
            ->columnName('integration_entity')
97
            ->nullable()
98
            ->build();
99
        $builder->createField('integrationEntityId', 'string')
100
            ->columnName('integration_entity_id')
101
            ->nullable()
102
            ->build();
103
        $builder->createField('internalEntity', 'string')
104
            ->columnName('internal_entity')
105
            ->nullable()
106
            ->build();
107
        $builder->createField('internalEntityId', 'integer')
108
            ->columnName('internal_entity_id')
109
            ->nullable()
110
            ->build();
111
112
        $builder->createField('lastSyncDate', 'datetime')
113
            ->columnName('last_sync_date')
114
            ->nullable()
115
            ->build();
116
117
        $builder->addNullableField('internal', 'array');
118
    }
119
120
    /**
121
     * @return int
122
     */
123
    public function getId()
124
    {
125
        return $this->id;
126
    }
127
128
    /**
129
     * @return string
130
     */
131
    public function getIntegration()
132
    {
133
        return $this->integration;
134
    }
135
136
    /**
137
     * @param string $integration
138
     *
139
     * @return IntegrationEntity
140
     */
141
    public function setIntegration($integration)
142
    {
143
        $this->integration = $integration;
144
145
        return $this;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getIntegrationEntity()
152
    {
153
        return $this->integrationEntity;
154
    }
155
156
    /**
157
     * @param string $integrationEntity
158
     *
159
     * @return IntegrationEntity
160
     */
161
    public function setIntegrationEntity($integrationEntity)
162
    {
163
        $this->integrationEntity = $integrationEntity;
164
165
        return $this;
166
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getIntegrationEntityId()
172
    {
173
        return $this->integrationEntityId;
174
    }
175
176
    /**
177
     * @param string $integrationEntityId
178
     *
179
     * @return IntegrationEntity
180
     */
181
    public function setIntegrationEntityId($integrationEntityId)
182
    {
183
        $this->integrationEntityId = $integrationEntityId;
184
185
        return $this;
186
    }
187
188
    /**
189
     * @return \DateTime
190
     */
191
    public function getDateAdded()
192
    {
193
        return $this->dateAdded;
194
    }
195
196
    /**
197
     * @param \DateTime $dateAdded
198
     *
199
     * @return IntegrationEntity
200
     */
201
    public function setDateAdded($dateAdded)
202
    {
203
        $this->dateAdded = $dateAdded;
204
205
        return $this;
206
    }
207
208
    /**
209
     * @return \DateTime
210
     */
211
    public function getLastSyncDate()
212
    {
213
        return $this->lastSyncDate;
214
    }
215
216
    /**
217
     * @param \DateTime $lastSyncDate
218
     *
219
     * @return IntegrationEntity
220
     */
221
    public function setLastSyncDate($lastSyncDate)
222
    {
223
        $this->lastSyncDate = $lastSyncDate;
224
225
        return $this;
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getInternalEntity()
232
    {
233
        return $this->internalEntity;
234
    }
235
236
    /**
237
     * @param string $internalEntity
238
     *
239
     * @return IntegrationEntity
240
     */
241
    public function setInternalEntity($internalEntity)
242
    {
243
        $this->internalEntity = $internalEntity;
244
245
        return $this;
246
    }
247
248
    /**
249
     * @return int
250
     */
251
    public function getInternalEntityId()
252
    {
253
        return $this->internalEntityId;
254
    }
255
256
    /**
257
     * @param int $internalEntityId
258
     *
259
     * @return IntegrationEntity
260
     */
261
    public function setInternalEntityId($internalEntityId)
262
    {
263
        $this->internalEntityId = $internalEntityId;
264
265
        return $this;
266
    }
267
268
    /**
269
     * @return array
270
     */
271
    public function getInternal()
272
    {
273
        return $this->internal;
274
    }
275
276
    /**
277
     * @param array $internal
278
     *
279
     * @return IntegrationEntity
280
     */
281
    public function setInternal($internal)
282
    {
283
        $this->internal = $internal;
284
285
        return $this;
286
    }
287
}
288