/** * throw new exeption * exeption go to logger */ public static function getStaticException($exception) { /** * get error message */ $ErrorMessage = $exception->getMessage(); /** * get error number */ $ErrorNumber = $exception->getCode(); /** * get error file (in source) */ $ErrorFile = $exception->getFile(); /** * get error line (in source) */ $ErrorLine = $exception->getLine(); /** * object instance of objectManager */ $objectManager = ObjectManager::getInstance(); /** * Logger instance */ $Logger = $objectManager->getObject('Logger'); /** * LogError to Logger */ $Logger->LogError($ErrorNumber, $ErrorMessage, $ErrorFile, $ErrorLine); }
public function run() { Request::parse(); $controller = 'PY\\App\\Controllers\\' . ucfirst(Request::$controller); $method = Request::$method; $objectManager = ObjectManager::getInstance(); echo $objectManager->invokeMethod($objectManager->get($controller), $method); }
/** * Get MTF Object Manager instance * * @return ObjectManager */ public static function getObjectManager() { if (!($objectManager = ObjectManager::getInstance())) { $objectManagerFactory = new self(); $objectManager = $objectManagerFactory->create(); } return $objectManager; }
/** * Magic function GET * * @return void */ public function connect() { // Instance of ObjectManager $this->objectManager = ObjectManager::getInstance(); // Connect Database $this->DatabasePointer = $this->objectManager->getObject('DBConnectManager')->connectRouter(); return $this; }
/** * Initialize */ public function __construct() { // ObjectManager $this->objectManager = ObjectManager::getInstance(); // Registry $this->registry = $this->objectManager->getObject('Registry'); // FLRP protocol $this->flrp = $this->objectManager->getObject('flrp'); }
/** * @public * destroy all objects */ public static function destroyAllObjects() { $objectManager = ObjectManager::getInstance(); self::$objects = $objectManager->getAllObjectInstances(); foreach (self::$objects as $key => $ObjectInstance) { if (is_object($ObjectInstance)) { self::destroyObject($ObjectInstance); } } self::BufferEmpty(); }
/** * Initializes database table object * params * :: Table :: Name of Database Table * :: Fields:: Array with Fields from Table * * @return void */ public function __construct($table, $fields) { // Database Table $this->table = $table; // Init Fields of Table foreach ($fields as $key) { $this->fields[$key] = null; } // Instance of ObjectManager $this->objectManager = ObjectManager::getInstance(); // Connect Database $this->DatabasePointer = $this->objectManager->getObject('DBConnectManager')->connectRouter(); }
/** * @public function * ErrorHandling for trigger_error * */ public static function ErrorHandling($ErrorNumber, $ErrorMessage, $ErrorFile, $ErrorLine) { /** * object instance of objectManager */ $objectManager = ObjectManager::getInstance(); /** * Logger instance */ $Logger = $objectManager->getObject('Logger'); /** * LogError to Logger */ $Logger->LogError($ErrorNumber, $ErrorMessage, $ErrorFile, $ErrorLine); }
/** * Initialize */ public function __construct() { // ObjectManager aufrufen $this->objectManager = ObjectManager::getInstance(); // Registry $this->registry = $this->objectManager->getObject('Registry'); // Request $this->request = $this->objectManager->getObject('Request'); // Debug Trace $this->debug = $this->objectManager->getObject('Debug'); // Database access point $this->database = $this->objectManager->getObject('Database'); $this->database->connect(); return $this; }
/** * static funtion * setHiddenFieldsOfRoute * * @params NameOfUnity * @params NameOfScreen * @params NameOfAction * */ public static function setHiddenFieldsOfRoute($NameOfUnity, $NameOfScreen, $NameOfAction) { // ObjectManager self::$objectManager = ObjectManager::getInstance(); // Configuration self::$registry = self::$objectManager->getObject('Registry'); // Fields of USC Routing $AppsFieldUnity = self::$registry->hiddenfieldsUnity; $AppsFieldScreen = self::$registry->hiddenfieldsScreen; $AppsFieldAction = self::$registry->hiddenfieldsAction; // Line Feed self::$CR = BaseHelperEscapeChars::getEscapeChar('CR'); // set ARRAY self::$routing = array(self::$CR . '<input type="hidden" id="' . $AppsFieldUnity . '" name="' . $AppsFieldUnity . '" value="' . $NameOfUnity . '">' . self::$CR, '<input type="hidden" id="' . $AppsFieldScreen . '" name="' . $AppsFieldScreen . '" value="' . $NameOfScreen . '">' . self::$CR, '<input type="hidden" id="' . $AppsFieldAction . '" name="' . $AppsFieldAction . '" value="' . $NameOfAction . '">' . self::$CR); // Return of USC Routing return self::$routing; }
/** * Initialize */ public function __construct() { // ObjectManager aufrufen $this->objectManager = ObjectManager::getInstance(); // Registry $this->registry = $this->objectManager->getObject('Registry'); // Request $this->request = $this->objectManager->getObject('Request'); // Debug Trace $this->debug = $this->objectManager->getObject('Debug'); /* * Autoconnect ? */ if ($this->registry->databaseAutoconnect == true) { // Database objct $this->database = $this->objectManager->getObject('Database'); $this->database->connect(); } // back instance of object return $this; }
/** * @access public * init ObjectManager */ public function __construct() { // Instance of object manager $this->objectManager = ObjectManager::getInstance(); // Instance of registry $this->registry = $this->objectManager->getObject('Registry'); }
/** * Initializes the Object Manager * * @return void */ private function initializeObjectManager() { $this->objectManager = ObjectManager::getInstance(); }
/** * @access public * __construct initialize */ public function __construct() { $this->objectManager = ObjectManager::getInstance(); }
public function editAction($postId) { $profile = $this->models['Profile']->getProfileForUser(false); $post = $this->models['ForumPost']->findById($postId); $topic = $post->topic; $isModerator = $this->models['ForumBoard']->isProfileModerator($profile->id, $topic->board); if (!$profile || !$post || $post->author->id != $profile->id && !$isModerator) { $this->response->setRedirect($this->request->getBasePath()); return; } $emoticonParser = $this->models['ForumPost']->getEmoticonParser(); $form = new ForumPostForm($this->request->getBasePath() . '/edit/' . $post->id, $post, $emoticonParser); $preview = null; if ($form->isSubmitted()) { if ($form->getValue(ForumPostForm::FIELD_CANCEL)) { $this->response->setRedirect($this->request->getBasePath() . '/topic/' . $topic->id . '#post' . $post->id); return; } try { $post = $form->getPost(); if ($form->isPreview()) { $preview = $post; } else { $post->authorModified = $profile->id; $this->models[ForumPostModel::NAME]->save($post); $post = $this->models[ForumPostModel::NAME]->findById($post->id); $url = ObjectManager::getInstance()->getUrl(ForumPostModel::NAME, $post); $this->response->setRedirect($this->request->getBaseUrl() . '/' . $url); return; } } catch (ValidationException $e) { $form->setValidationException($e); } } $emoticonParser = $this->models['ForumPost']->getEmoticonParser(); $view = new ForumPostFormView($form, 'joppa.forum.button.post.add', $preview, $emoticonParser); $this->response->setView($view); }