melisplatform / melis-platform-framework-symfony
Installs: 493
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 0
Open Issues: 0
Type:melisplatform-module
Requires
- php: ^8.0
- ext-ctype: *
- ext-iconv: *
- composer/package-versions-deprecated: ^1.11
- doctrine/annotations: ^1.13
- doctrine/common: ^3.2.2
- doctrine/migrations: 3.4.2
- egulias/email-validator: ^2.1.10
- laminas/laminas-code: 3.4.1
- melisplatform/melis-platform-frameworks: ^5.0
- phpdocumentor/reflection-docblock: ^5.3
- phpstan/phpdoc-parser: ^1.4
- psr/cache: 1.0.1
- psr/link: 1.0.0
- sensio/framework-extra-bundle: ^6.2
- symfony/amqp-messenger: ^5.4
- symfony/asset: ^5.4
- symfony/console: ^5.4
- symfony/doctrine-messenger: 5.4.*
- symfony/dotenv: ^5.4
- symfony/error-handler: ^5.4
- symfony/event-dispatcher: ^5.4
- symfony/event-dispatcher-contracts: ^2.5
- symfony/expression-language: ^5.4
- symfony/flex: ^1.17
- symfony/form: ^5.4
- symfony/framework-bundle: ^5.4
- symfony/http-client: ^5.4
- symfony/http-foundation: ^5.4
- symfony/http-kernel: ^5.4
- symfony/intl: ^5.4
- symfony/mailer: 5.4.*
- symfony/messenger: ^5.4
- symfony/mime: 5.4.*
- symfony/monolog-bundle: ^3.7
- symfony/notifier: 5.4.*
- symfony/options-resolver: ^5.4
- symfony/orm-pack: ^2.2
- symfony/password-hasher: ^5.4
- symfony/process: ^5.4
- symfony/property-access: ^5.4
- symfony/property-info: ^5.4
- symfony/proxy-manager-bridge: ^5.4
- symfony/redis-messenger: ^5.4
- symfony/routing: ^5.4
- symfony/runtime: 5.4.*
- symfony/security-bundle: ^5.4
- symfony/security-csrf: ^5.4
- symfony/serializer: ^5.4
- symfony/stopwatch: ^5.4
- symfony/swiftmailer-bundle: ^3.5
- symfony/translation: ^5.4
- symfony/twig-bridge: ^5.4
- symfony/twig-bundle: ^5.4
- symfony/validator: ^5.4
- symfony/var-exporter: ^5.4
- symfony/web-link: ^5.4
- symfony/webapp-meta: ^1.0
- symfony/webpack-encore-bundle: ^1.12
- symfony/yaml: ^5.4
- twig/extra-bundle: ^2.12|^3.0
- twig/twig: ^3.3
Requires (Dev)
- symfony/debug-bundle: 5.4.*
- symfony/debug-pack: *
- symfony/maker-bundle: ^1.38
- symfony/profiler-pack: *
- symfony/stopwatch: 5.4.*
- symfony/test-pack: *
- symfony/web-profiler-bundle: 5.4.*
- symfony/web-server-bundle: ^4.4
- dev-master
- v5.0.1
- v5.0.0
- v4.1.1
- v4.1.0
- v4.0.0
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- dev-update/php83
- dev-develop
- dev-update/utf8mb4
- dev-update/php-8-upgrade
- dev-update/replace-ocramius-pkg
- dev-migrate/laminas
- dev-moduleCreator
- dev-update/jquery3
- dev-symfonyDemoFull
This package is auto-updated.
Last update: 2024-12-06 06:14:21 UTC
README
This bundle is the gateway for Symfony in order to make a connection to Melis platform like accessing the registered services and automatically use the database connection of the platform.
Getting Started
These instructions will get you a copy of the project up and running on your machine.
Prerequisites
You will need to install the following in order to have this module running:
- melisplatform/melis-platform-frameworks
It will automatically be done when using composer.
Installing
Run the composer command:
composer require melisplatform/melis-platform-framework-symfony
Running the code
Activating the module
Activating this bundle is just the same way you activate your bundle inside symfony application. You just need to include its bundle class to the list of bundles inside symfony application (most probably in bundles.php file).
return [
//All of the symfony activated bundles here
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
...
...
etc.
//Melis Platform Custom Bundles
MelisPlatformFrameworkSymfony\MelisPlatformFrameworkSymfonyBundle::class => ['all' => true]
];
Accessing Melis Platform Service
MelisServiceManager Class
- This class is the gateway for Symfony in order to make a connection to Melis platform. Therefore, using this class we can get all of Melis platform registered services.
- You can call this class inside symfony application as a service by calling its registered
service key
melis_platform.service_manager
or by using a Dependency Injection. (See example below)
Example:
//Using Dependency Injection
//Assuming we are inside a controller
protected $melisServiceManager;
//Inject MelisServiceManager in the controller constructor function
public function __construct(MelisServiceManager $melisServiceManager)
{
$this->melisServiceManager = $melisServiceManager;
}
//And then we can use the melis provider like this
//to get the language list of the Back Office
$melisCoreTableLang = $this->melisServiceManager->getService('MelisCoreTableLang');
$melisCorelangList = $melisCoreTableLang->fetchAll()->toArray();
//Using service key (melis_platform.service_manager)
//Assuming we are inside of any custom Symfony controller that extends AbstractController of Symfony
//Calling the service
$melisServices = $this->get('melis_platform.service_manager');
//Calling the MelisCoreTableLang service registered in Melis Platform
$languageTable = $melisServices->getService('MelisCoreTableLang');
//Calling fetchAll function inside MelisCoreTableLang service and convert the result to array
$languageList = $languageTable->fetchAll()->toArray();
-
Bundles that are inside the Symfony skeleton might have a problem accessing the
melis_platform.service_manager
service key inside their Controller that extends AbstractController since AbstractController only uses a limited container that only contains some services.But we can still use the
melis_platform.service_manager
service key by overriding thegetSubscribedServices
function of the AbstractController inside our Controller to register our service.
public static function getSubscribedServices()
{
return array_merge(parent::getSubscribedServices(),
[
'melis_platform.service_manager' => MelisServiceManager::class,
]);
}
Event Listeners
DatabaseSwitcherListener
- This listener will force Symfony to use the Melis Platform database.
SymfonyTranslationsListener
- This listener will get all of Symfony translations and store it inside a file (Resources/translations/melis/symfony-translations.phtml) so that Melis Platform can use this translations. This file MUST be writable.
Authors
- Melis Technology - www.melistechnology.com
See also the list of contributors who participated in this project.
License
This project is licensed under the OSL-3.0 License - see the LICENSE