1<?php 2/** 3 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures 4 * all the essential functionalities required for any enterprise. 5 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com 6 * 7 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of 8 * the GNU General Public License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * See the GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along with this program; 16 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA 18 */ 19 20/** 21 * Class FormatWithPayGradeId 22 */ 23class FormatWithPayGradeId implements ValueFormatter 24{ 25 26 private $payGradeService; 27 28 /** 29 * @param $entityValue 30 * @return mixed|string 31 */ 32 public function getFormattedValue($entityValue) 33 { 34 return $this->getPayGradeService()->getPayGradeById($entityValue)->getName(); 35 } 36 37 /** 38 * @return PayGradeService 39 */ 40 public function getPayGradeService() 41 { 42 if (is_null($this->payGradeService)) { 43 $this->payGradeService = new PayGradeService(); 44 $this->payGradeService->setPayGradeDao(new PayGradeDao()); 45 } 46 return $this->payGradeService; 47 } 48} 49