yottacms/framework

Basic framework for Yotta.CMS

v0.1.5 2020-01-16 20:18 UTC

This package is auto-updated.

Last update: 2024-04-17 05:57:04 UTC


README

Installation

composer require yottacms/framework

Usage

Рекурсивная разгрузка зависимых бандлов

// src/Kernel.php in Symfony >= v4
use YottaCms\Framework\Component\HttpKernel\PreloadBundlesKernelTrait;
// ...

class Kernel extends BaseKernel
{
    use MicroKernelTrait, PreloadBundlesKernelTrait;

    // remove or rename default "registerBundles" method (it will be replaced by PreloadBundlesKernelTrait)
    public function registerBundlesDisabled()
    {
        $contents = require $this->getProjectDir().'/config/bundles.php';
        foreach ($contents as $class => $envs) {
            if (isset($envs['all']) || isset($envs[$this->environment])) {
                yield new $class();
            }
        }
    }

    // ...
}

// YourBundle.php
namespace YourBundleNS;
use Symfony\Component\HttpKernel\Bundle\Bundle;
// ...

class YourBundle extends Bundle
{
    public function registerBundles()
    {
        return [
            \Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle::class => ['all' => true],   // @example
        ];
    }
}