Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24894584
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/workspaces/src/Engines/Apps/Application.php b/workspaces/src/Engines/Apps/Application.php
index d87208a..889e4de 100644
--- a/workspaces/src/Engines/Apps/Application.php
+++ b/workspaces/src/Engines/Apps/Application.php
@@ -1,84 +1,95 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Application class
*
* @package ObsidianWorkspaces
* @subpackage Apps
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
namespace Waystone\Workspaces\Engines\Apps;
use Waystone\Workspaces\Engines\Controller\Controller;
use Waystone\Workspaces\Engines\Errors\ErrorHandling;
use Waystone\Workspaces\Engines\Workspaces\WorkspaceConfiguration;
use Collection;
use Exception;
/**
* Application class
*
* This class describes an application
*/
abstract class Application extends Controller {
/**
* @var string The application name
*/
public static $name;
/**
* @var ApplicationContext The current application context
*/
public $context;
/**
* @var Collection[] The collections, keys as collections roles and values as
* collections names.
*/
public $collections = [];
/**
* Initializes the controller resources
*/
public function initialize () {
$this->collections = $this->loadCollections();
+
+ try {
+ $this->onAfterInitialize();
+ } catch (Exception $ex) {
+ ErrorHandling::messageAndDie(GENERAL_ERROR, $ex->getMessage(), "Can't load application");
+ }
+
}
/**
* Loads the collection
*/
private function loadCollections () : array {
$loadedCollections = [];
$workspaceCollections =
$this->context->workspace->configuration->collections;
foreach (
$this->context->configuration->useCollections as $role => $name
) {
if (!array_key_exists($name, $workspaceCollections)) {
$name =
WorkspaceConfiguration::getCollectionNameWithPrefix($this->context->workspace,
$name);
if (!array_key_exists($name, $workspaceCollections)) {
throw new Exception("Collection not found: $name");
}
}
$loadedCollections[$role] =
Collection::load($name, $workspaceCollections[$name]);
}
return $loadedCollections;
}
+
+ protected function onAfterInitialize () : void {
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Mar 18, 12:57 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3539897
Default Alt Text
(2 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment