Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @readme I had an issue recently whereby a telephone number was being interpreted as a number
- * value in the view with the Zend framework, so 01212112121 in the DB was being
- * displayed as 1212112121 to the user. It may not be the most elegant solution, but this method works.
- * @author Shaun B
- * @date 2015-09-10
- */
- private function getUserPhoneNumber()
- {
- $userId = $this->getUserId();
- $usersModel = new Application_Model_DbTable_Users();
- $userTelephoneNumber = $usersModel->getUserPhoneNumber($userId);
- return is_string($userTelephoneNumber) ? $userTelephoneNumber : "0" . $userTelephoneNumber;
- }
- /**
- * @readme So, I can now safely pass this to the view with the leading zero, ie:
- */
- public function userDetailsAction()
- {
- ## Some logic...
- $this->view->userTelephoneNumber = $this->getUserPhoneNumber();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement