Skip to content

Commit

Permalink
Added catalog_elements_links
Browse files Browse the repository at this point in the history
  • Loading branch information
ufee committed Apr 19, 2020
1 parent 8d4d430 commit 91bae1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/Models/Lead.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class Lead extends \Ufee\Amo\Base\Models\ModelWithCF
'closest_task_at',
'visitor_uid',
'loss_reason_id',
'loss_reason_name'
'loss_reason_name',
'catalog_elements_links'
];

/**
Expand Down Expand Up @@ -93,6 +94,13 @@ protected function _boot($data = [])
$this->attributes['catalog_elements_id'] = $data->catalog_elements->id;
}
$this->attributes['contacts'] = null;

$this->attributes['catalog_elements_links'] = [];
if (isset($data->_embedded->catalog_elements_links)) {
foreach ($data->_embedded->catalog_elements_links as $catalog_element_link) {
$this->attributes['catalog_elements_links'][$catalog_element_link->id] = $catalog_element_link;
}
}
unset(
$this->attributes['main_contact'], $this->attributes['pipeline']->_links
);
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Leads.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Leads extends \Ufee\Amo\Base\Services\MainEntity
protected function _boot()
{
parent::_boot();
$this->api_args['with'] = 'loss_reason_name';
$this->api_args['with'] = 'loss_reason_name,catalog_elements_links';
}

/**
Expand Down

0 comments on commit 91bae1b

Please sign in to comment.