36 lines
747 B
PHP
36 lines
747 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Antadis\API\Front\Models\Carrier as BaseCarrier;
|
|
|
|
/**
|
|
* @rest\model Carrier
|
|
* @rest\property inetger is_relay
|
|
*/
|
|
class Carrier extends BaseCarrier
|
|
{
|
|
protected $_relayConfiguration = NULL;
|
|
|
|
/**
|
|
* Returns carrier_ids which are relay
|
|
* @return type
|
|
*/
|
|
protected function getRelayConfiguration() {
|
|
if ($this->_relayConfiguration === NULL) {
|
|
$this->_relayConfiguration = \Configuration::get('ANT_CARRIERS_OOH');
|
|
}
|
|
return $this->_relayConfiguration;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toArray() {
|
|
$relayConfiguration = $this->getRelayConfiguration();
|
|
return array_merge(parent::toArray(), array(
|
|
'is_relay' => in_array($this->id, explode(',', $relayConfiguration))
|
|
));
|
|
}
|
|
}
|