/var/www/vhosts/ihelp.ro/httpdocs/src/Model/Entity
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/Model/Entity/UserAddress.php (4122B)
true
];
/**
* Fields virtual.
*/
protected $_virtual = [
'full_name', 'address', 'full_address', 'compact_address'
];
/**
* _getFullAddress
*/
protected function _getFullAddress()
{
if ($this->county_id && $this->city_id) {
$countyEntity = TableRegistry::getTableLocator()->get('Counties');
$cityEntity = TableRegistry::getTableLocator()->get('Cities');
$county = $countyEntity->find()->where(['Counties.id' => $this->county_id])->first();
$city = $cityEntity->find()->where(['Cities.id' => $this->city_id])->first();
$full_address = $this->full_name .
': ' . __('Tel.: ') .
$this->phone .
': ' . __('Județ: ')
. $county->name .
', ' . __('Oraș: ')
. $city->name .
', ' . __('Str: ')
. $this->str .
', ' . __('Nr: ')
. $this->nr .
($this->bl ? ', ' . __('Bl: ') . $this->bl : '') .
($this->sc ? ', ' . __('Sc: ') . $this->sc : '') .
($this->ap ? ', ' . __('Ap: ') . $this->ap : '') .
($this->interfon ? ', ' . __('Interfon: ') . $this->interfon : '') .
', ' . __('Cod poștal: ')
. $this->postal_code;
return $full_address;
}
}
/**
* getCompactAddress
*/
protected function _getCompactAddress()
{
if ($this->county_id && $this->city_id) {
$countyEntity = TableRegistry::getTableLocator()->get('Counties');
$cityEntity = TableRegistry::getTableLocator()->get('Cities');
$county = $countyEntity->find()->where(['Counties.id' => $this->county_id])->first();
$city = $cityEntity->find()->where(['Cities.id' => $this->city_id])->first();
$compact_address =
$county->name .
', ' . $city->name .
', ' . $this->str .
', ' . $this->nr .
($this->bl ? ', ' . $this->bl : '') .
($this->sc ? ', ' . $this->sc : '') .
($this->ap ? ', ' . $this->ap : '') .
($this->interfon ? ', ' . $this->interfon : '') .
', ' . $this->postal_code;
return trim($compact_address);
}
}
/**
* getCompactAddress
*/
protected function _getAddress()
{
if ($this->county_id && $this->city_id) {
$countyEntity = TableRegistry::getTableLocator()->get('Counties');
$cityEntity = TableRegistry::getTableLocator()->get('Cities');
$county = $countyEntity->find()->where(['Counties.id' => $this->county_id])->first();
$city = $cityEntity->find()->where(['Cities.id' => $this->city_id])->first();
$compact_address =
__('Județ: ')
. $county->name .
', ' . __('Oraș: ')
. $city->name .
', ' . __('Str: ')
. $this->str .
', ' . __('Nr: ')
. $this->nr .
($this->bl ? ', ' . __('Bl: ') . $this->bl : '') .
($this->sc ? ', ' . __('Sc: ') . $this->sc : '') .
($this->ap ? ', ' . __('Ap: ') . $this->ap : '') .
($this->interfon ? ', ' . __('Interfon: ') . $this->interfon : '') .
', ' . __('Cod poștal: ')
. $this->postal_code;
return trim($compact_address);
}
}
/**
* _getFullName
*/
protected function _getFullName()
{
$full_name = $this->first_name . ' ' . $this->last_name;
return $full_name;
}
}