class PackageService (View source)

Service class for the package entities and controllers.

Properties

protected Localization $localization

The Localization service instance.

protected Application $application

The Application container instance.

protected EntityManagerInterface $entityManager

The EntityManagerInterface instance.

Methods

__construct(Localization $localization, Application $application, EntityManagerInterface $entityManager)

Initialize the instance.

Package|null
getByHandle(string $pkgHandle)

Get a package entity given its handle.

Package|null
getByID(int $pkgID)

Get a package entity given its ID.

getInstalledList()

Get the package entities of installed packages.

getAvailablePackages(bool $onlyNotInstalled = true)

Get the package controllers of the available packages.

getLocalUpgradeablePackages()

Get the controllers of packages that have newer versions in the local packages directory than those which are in the Packages table.

string[]
getInstalledHandles()

Get the handles of all the installed packages.

getRemotelyUpgradeablePackages()

Get the controllers of the packages that have an upgraded version available in the marketplace.

void
checkPackageUpdates(PackageRepository $repository, array $skipHandles = [])

No description

bootPackageEntityManager(Package $p, bool $clearCache = false)

Initialize the entity manager for a package.

uninstall(Package $p)

Uninstall a package.

install(Package $p, array $data)

Install a package.

getClass(string $pkgHandle)

Get the controller of a package given its handle.

setupLocalization(LocalizablePackageInterface $package, string|null $locale = null, $translator = 'current') deprecated

No description

Details

__construct(Localization $localization, Application $application, EntityManagerInterface $entityManager)

Initialize the instance.

Parameters

Localization $localization

the Localization service instance

Application $application

the Application container instance

EntityManagerInterface $entityManager

the EntityManagerInterface instance

Package|null getByHandle(string $pkgHandle)

Get a package entity given its handle.

Parameters

string $pkgHandle

Return Value

Package|null

Package|null getByID(int $pkgID)

Get a package entity given its ID.

Parameters

int $pkgID

Return Value

Package|null

Package[] getInstalledList()

Get the package entities of installed packages.

Return Value

Package[]

Package[] getAvailablePackages(bool $onlyNotInstalled = true)

Get the package controllers of the available packages.

Parameters

bool $onlyNotInstalled

true to get the controllers of not installed packages, false to get all the package controllers

Return Value

Package[]

Package[] getLocalUpgradeablePackages()

Get the controllers of packages that have newer versions in the local packages directory than those which are in the Packages table.

This means they're ready to be upgraded.

Return Value

Package[]

string[] getInstalledHandles()

Get the handles of all the installed packages.

Return Value

string[]

Package[] getRemotelyUpgradeablePackages()

Get the controllers of the packages that have an upgraded version available in the marketplace.

Return Value

Package[]

void checkPackageUpdates(PackageRepository $repository, array $skipHandles = [])

No description

Parameters

PackageRepository $repository
array $skipHandles

Return Value

void

bootPackageEntityManager(Package $p, bool $clearCache = false)

Initialize the entity manager for a package.

Parameters

Package $p

The controller of package

bool $clearCache

Should the entity metadata cache be emptied?

uninstall(Package $p)

Uninstall a package.

Parameters

Package $p

the controller of the package to be uninstalled

ErrorList|Package install(Package $p, array $data)

Install a package.

Parameters

Package $p

the controller of the package to be installed

array $data

data to be passed to the Package::validate_install(), Package::install(), ContentSwapper::swapContent(), ContentSwapper::on_after_swap_content() methods

Return Value

ErrorList|Package

return an ErrorList instance in case of errors, the package controller otherwise

Package getClass(string $pkgHandle)

Get the controller of a package given its handle.

Parameters

string $pkgHandle

Handle of package

Return Value

Package

setupLocalization(LocalizablePackageInterface $package, string|null $locale = null, $translator = 'current') deprecated

deprecated

No description

Parameters

LocalizablePackageInterface $package
string|null $locale
$translator