Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
contact.php
1<?php
3
5
6class Contact extends Client
7{
8 public function init($params)
9 {
10 //FIO -> NAME, LAST_NAME
11 //EMAIL -> EMAIL
12 //PHONE -> PHONE
13 //ZIP -> ADDRESS_POSTAL_CODE
14 //LOCATION ->
15 //CITY -> ADDRESS_CITY
16 //ADDRESS -> ADDRESS
17
18 foreach($params as $index=>$item)
19 {
20 $this->collection->addItem(
21 Integration\Service\Internal\Container\Item::create(
22 Integration\Service\Internal\Entity\Factory::create($this->getDstEntityTypeId())
23 ->setOriginId($index)
24 ->setOriginatorId(static::ANALITICS_ORIGINATOR_ID)
25 ->setName($item['NAME'])
26 ->setLastName($item['LAST_NAME'])
27 ->setEmail($item['EMAIL'])
28 ->setPhone($item['PHONE'])
29 ->setAddressPostalCode($item['ZIP'])
30 ->setAddress($item['ADDRESS']))
31 ->setInternalIndex($index)
32 );
33 }
34
35 $this->relationLoad();
36
37 return $this;
38 }
39
40 static protected function getUsersFieldsValues(array $indexes)
41 {
42 return static::getUserCollectionByTypeId(
43 static::loadUserCollection($indexes), Integration\Service\User\EntityType::TYPE_I)
44 ->toArray();
45 }
46
47 static protected function getProxy()
48 {
50 }
51
52 public function getSrcEntityTypeId()
53 {
54 return Integration\EntityType::USER;
55 }
56 public function getDstEntityTypeId()
57 {
58 return Integration\CRM\EntityType::CONTACT;
59 }
60}