Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ....
- /**
- * @param int $type
- * @return Application|Job
- * @throws ErrorException
- */
- public static function getTypeModel(int $type)
- {
- $objectType = AliasObjectType::findOne($type);
- switch ($objectType->type) {
- case self::TYPE_APPLICATION :
- return new Application();
- break;
- case self::TYPE_JOB :
- return new Job();
- break;
- default:
- throw new ErrorException('Unknown type');
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement