public function createResource($resourceName, ?array
$privileges = null,
$menuItemName = null,
$pluginID = null
) { // Check if resource already exists
if ($this->
hasResourceInDatabase($resourceName)) { throw new Enlight_Exception(sprintf('Resource "%s" already exists',
$resourceName));
} $resource =
new UserResource();
$resource->
setName($resourceName);
$resource->
setPluginId($pluginID);
if (!
empty($privileges)) { $privilegeObjects =
[];
foreach ($privileges as $name) { $privilege =
new Privilege();
$privilege->
setName($name);
$privilege->
setResource($resource);