voicenumberblock_id = $block->id; $this->countrycode = $block->countrycode; $this->areacode = $block->areacode; $this->number_prepend_zero = $block->number_prepend_zero; return true; } public function getFullNumber() { $number = $this->countrycode.$this->areacode.$this->number; return $number; } public function beforeSave() { if($this->ported_from && $this->port_in_date) { $this->ported_in = 1; } else { $this->ported_in = 0; } if($this->ported_to && $this->port_out_date) { $this->ported_out = 1; } else { $this->ported_out = 0; } if($this->active == 1 && !$this->_old_data->active) { $this->activated_date = date("U"); } } public function getProperty($name) { if($this->$name == null) { if($name == "block") { $this->block = new Voicenumberblock($this->voicenumberblock_id); return $this->block; } if($name == "orderproduct") { $this->orderproduct = new Orderproduct($this->orderproduct_id); return $this->orderproduct; } if($name == "contract") { $this->contract = new Contract($this->contract_id); return $this->contract; } $classname = ucfirst($name); $idfield = $name."_id"; $this->$name = new $classname($this->$idfield); if($this->$name->id) { return $this->$name; } else { return null; } } return $this->$name; } }