Pimcore + Docker

PimcoreのDockerコンテナを作成

Pimcore PHP-FPM Image

https://hub.docker.com/r/pimcore/pimcore

Pimcore Installation

https://pimcore.com/docs/6.x/Development_Documentation/Getting_Started/Installation.html

Nginxで運用するため、以下のfpmバージョンのイメージを採用。

pimcore/pimcore:PHP7.2-fpm or pimcore/pimcore:PHP7.2-fpm-stretch

上記イメージファイルによりPimcoreコンテナ作成後、コンテナ内でcomposerコマンドを実行

COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/demo pimcore

ユーザ名、パスワード、mysqlホスト、データベース名などを指定してインストールスクリプトを実行。
(–mysql-host-socketだけを指定して実行)

cd pimcore && COMPOSER_MEMORY_LIMIT=-1 ./vendor/bin/pimcore-install --mysql-host-socket=localhost

デイレクトリの所有者とアクセス権を修正します。

chown -R www-data:www-data pimcore
chmod -R 755 pimcore

注)
データベースセットアップには時間を要します。
php.ini 設定ファイル内で memory_limit 512M に設定しているかどうか要確認

Running database setup...

  6/11 [===============>------------]  54%

PimcoreのNginxの設定を追加後、動作を確認して下さい。
https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Nginx_Configuration.html

Pimcore10 Docker Image

Pimcore10イメージ

PHP8.0が必須のため以下のイメージを使用(Ubuntuベース)。

pimcore/pimcore:PHP8.0-fpm
https://hub.docker.com/layers/pimcore/pimcore/PHP8.0-fpm/images/sha256-f1535d145bfee403770d0d0faa4789d3d02b418cd6edc0bee4a5cd588a8c02c5?context=explore

Nginxイメージ

Alpineベースのイメージを使用。
https://hub.docker.com/layers/nginx/library/nginx/1.20.1-alpine/images/sha256-8aa43d4fc22f10ce729752af0a895f015360d46429902f075fe87c5d882d8d7d?context=explore


ファイルパーミッション

www-dataのID番号の相違

UbuntuAlpineとではwww-dataのIDが異なることに注意。

UID/GID Ubuntu Alpine
33 www-data xfs
82 - www-data

NginxPHP8.0-fpm 双方のコンテナに共有のフォルダ www/html/pimcoreNginxによる管理者権限を与えるため、Nginxのコンテナ内で以下パーミッションを設定。

$ docker exec -ti nginx bash 
# chown -R nginx:nginx pimcore
# find pimcore -type d -exec chmod 755 {} \;
# find pimcore -type f -exec chmod 644 {} \;

pimcore フォルダ内の var public/var フォルダについては PHP8.0-fpm ユーザに管理者権限を付与する必要があるため以下追加。
(ユーザは、Nginxコンテナ内ではxfs,PHP8.0-fpmコンテナ内ではwww-dataとすること。)

上記コンソール画面の続き

# cd pimcore
# chown -R xfs:xfs var public/var bin/*
# chmod ug+x bin/*
# chmod -R 440 config

Pimcore File Permission
https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/File_Permissions.html

クローンジョブ

ホストマシンでコンテナのクローンジョブを実行。 php-fpmのユーザ(www-data等) を指定すること。

$ sudo crontab -e
*/10 * * * * docker exec -u www-data pimcore-fpm /var/www/html/pimcore10/bin/console pimcore:maintenance --async

下記下段のジョブは任意。最新のエラーログを表示・確認する際に便利。

https://pimcore.com/docs/pimcore/current/Development_Documentation/Getting_Started/Installation.html#page_5-Maintenance-Cron-Job

# this command needs anyway executed via cron or similar task scheduler
# it fills the message queue with the necessary tasks, which are then processed by messenger:consume
*/5 * * * * /your/project/bin/console pimcore:maintenance --async

# it's recommended to run the following command using a process control system like Supervisor
# please follow the Symfony Messenger guide for a best practice production setup: 
# https://symfony.com/doc/current/messenger.html#deploying-to-production
*/5 * * * * /your/project/bin/console messenger:consume pimcore_core pimcore_maintenance --time-limit=300

docker execコマンド

使用しないバンドルの無効化

下記コマンド(コンテナ内)でバンドルリストを確認後、無効化。

# bin/console pimcore:bundle:list
+------------------------------------------+---------+-----------+-------------+---------------+----------+
| Bundle                                   | Enabled | Installed | Installable | Uninstallable | Priority |
+------------------------------------------+---------+-----------+-------------+---------------+----------+
| PimcoreCustomerManagementFrameworkBundle | ❌       | ❌         | ❌           | ❌             | ❌        |
| OutputDataConfigToolkitBundle            | ❌       | ❌         | ❌           | ❌             | ❌        |
| PimcoreDataHubBundle                     | ❌       | ❌         | ❌           | ❌             | ❌        |
| PimcoreEcommerceFrameworkBundle          | ❌       | ❌         | ❌           | ❌             | ❌        |
| PimcorePaymentProviderUnzerBundle        | ❌       | ❌         | ❌           | ❌             | ❌        |
| NumberSequenceGeneratorBundle            | ❌       | ❌         | ❌           | ❌             | ❌        |
| ObjectMergerBundle                       | ✔       | ✔         | ❌           | ❌             | ✔        |
| Web2PrintToolsBundle                     | ❌       | ❌         | ❌           | ❌             | ❌        |
+------------------------------------------+---------+-----------+-------------+---------------+----------+

例)イーコマースバンドルは使用していないので、

# bin/console pimcore:bundle:disable PimcoreEcommerceFrameworkBundle

設定ファイルからイーコマース関連の設定ファイルも無効化。

config/config.yaml

imports:
    - { resource: services.yaml }
    - { resource: 'local/' }
#    - { resource: ecommerce/base-ecommerce.yaml }
#    - { resource: cmf.yaml }
    - { resource: workflows.yaml }

config/services.yaml からも不必要なイーコマースに関係する箇所を削除またはコメントアウトすること(一部抜粋)。下記 secret: xxxxxxxxxx..... は必要。

parameters:
    secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    #google_client_id: <google_client_id>
    #google_client_secret: <google_client_secret>
    #twitter_client_id: <twitter_client_id>
    #twitter_client_secret: <twitter_client_secret>
......
......
......

Symfony Framework Configuration Reference (FrameworkBundle)

Workflow Management

https://pimcore.com/docs/pimcore/current/Development_Documentation/Workflow_Management/index.html#page_Workflow-Management

イーコマースとカスタマーユーザで使用している HWIOAuthBundle を無効化

以下のファイルからHWIOAuthBundleの箇所をコメントアウト。

src/Kernal.php

namespace App;

/*use HWI\Bundle\OAuthBundle\HWIOAuthBundle;*/
use Pimcore\HttpKernel\BundleCollection\BundleCollection;
use Pimcore\Kernel as PimcoreKernel;

class Kernel extends PimcoreKernel
{
    /**
     * Adds bundles to register to the bundle collection. The collection is able
     * to handle priorities and environment specific bundles.
     *
     * @param BundleCollection $collection
     */
    public function registerBundlesToCollection(BundleCollection $collection)
    {

        // activate bundle for SSO oauth login/register functionality
        if (class_exists('\Http\HttplugBundle\HttplugBundle')) {
            $collection->addBundle( new \Http\HttplugBundle\HttplugBundle());
        }
        /*$collection->addBundle(HWIOAuthBundle::class);*/

    }
}

Pimcore Single Sign On

Symfony Authenticating Users

Github HWIOAuthBundle


イーコマース、カスタマーマネージメントフレームワークの設定ファイルの読込みをコメントアウトして無効化。

config/config.yaml

imports:
    - { resource: services.yaml }
    - { resource: 'local/' }
#    - { resource: ecommerce/base-ecommerce.yaml } 
#    - { resource: cmf.yaml }
    - { resource: workflows.yaml }

HWIOAuthの箇所をコメントアウトまたは削除

config/routes.yaml

#hwi_oauth_redirect:
#    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
#    prefix:   /connect

#hwi_oauth_connect:
#    resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
#    prefix:   /connect

#hwi_oauth_login:
#    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
#    prefix:   /auth/oauth

#app_auth_oauth_check_google:
#    path: /auth/oauth/check/google

#app_auth_oauth_check_twitter:
#    path: /auth/oauth/check/twitter

不必要な箇所をコメントアウトまたは削除。

config/services.yaml

parameters:
    secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#    google_client_id: <google_client_id>
#    google_client_secret: <google_client_secret>
#    twitter_client_id: <twitter_client_id>
#    twitter_client_secret: <twitter_client_secret>
    
    # use echo \Defuse\Crypto\Key::createNewRandomKey()->saveToAsciiSafeString(); to generate secret for data encryption
    app_encryption_secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

services:
    # default configuration for services in *this* file
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # this means you cannot fetch services directly from the container via $container->get()
        # if you need to do this, you can override this setting on individual services
        public: false


    # ---------------------------------------------------------
    # Register all controllers of App as services
    # ---------------------------------------------------------
    App\Controller\:
        resource: '../src/Controller'
        public: true
        tags: ['controller.service_arguments']



    # ---------------------------------------------------------
    # Register all commands of App as commands
    # ---------------------------------------------------------
    App\Command\:
        resource: '../src/Command'
        tags: ['console.command']



    # ---------------------------------------------------------
    # Forms
    # ---------------------------------------------------------
#    App\Form\DeliveryAddressFormType: ~
#    App\Form\LoginFormType: ~
#    App\Form\RegistrationFormType: ~
#    App\Form\RegistrationFormHandler: ~
#    App\Form\CarSubmitFormType: ~



    # ---------------------------------------------------------
    # Misc Services
    # ---------------------------------------------------------
    App\Services\PasswordRecoveryService: ~
    App\Services\NewsletterDoubleOptInService: ~
    App\Services\SegmentTrackingHelperService: ~
    App\Services\Workflow\CustomHtmlService: ~
    App\Website\Navigation\BreadcrumbHelperService: ~

#    App\Model\Product\CalculatedValue\QualityCalculator:
#        public: true

#    App\Model\Product\CalculatedValue\AccessoryPartName:
#        public: true


    # ---------------------------------------------------------
    # Twig Extensions
    # ---------------------------------------------------------
#    App\Twig\Extension\CategoryFilterExtension:
#        tags: ['twig.extension']

#    App\Twig\Extension\Country:
#        tags: ['twig.extension']

#    App\Twig\Extension\Currency:
#        tags: ['twig.extension']

    App\Twig\Extension\GeneralFilterExtension:
        tags: ['twig.extension']

    App\Twig\Extension\NavigationExtension:
        tags: ['twig.extension']

    App\Twig\Extension\UniqidExtension:
        tags: ['twig.extension']

    App\Twig\Extension\LanguageSwitcherExtension:
        tags: ['twig.extension']

#    App\Twig\Extension\ProductPageExtension:
#        tags: ['twig.extension']

    App\Twig\Extension\BlogExtension:
        tags: ['twig.extension']

    App\Twig\Extension\NewsExtension:
        tags: ['twig.extension']

#    App\Twig\Extension\PrintCatalogExtension:
#        tags: ['twig.extension']


    # ---------------------------------------------------------
    # Link Generators for DataObjects
    # ---------------------------------------------------------
#    App\Website\LinkGenerator\CategoryLinkGenerator:
#        public: true

#    App\Website\LinkGenerator\ProductLinkGenerator:
#        public: true

    App\Website\LinkGenerator\BlogLinkGenerator:
        public: true

    App\Website\LinkGenerator\NewsLinkGenerator:
        public: true


    # ---------------------------------------------------------
    # Overwrite Pimcore Default Services
    # ---------------------------------------------------------

    # overwrite PimcoreUrl helper to add existing parameters to generated urls
    Pimcore\Twig\Extension\Templating\PimcoreUrl:
        class: App\Website\Tool\PimcoreUrl
        arguments:
            $generator: '@router'



    # ---------------------------------------------------------
    # Event Listeners
    # ---------------------------------------------------------

    # auto sets name based on key for bodystyle, manufacturer, category
#    App\EventListener\NameSettingListener:
#        tags:
#            - { name: kernel.event_listener, event: pimcore.dataobject.preAdd, method: onPreAdd }

    # adds additional static files to admin backend
    App\EventListener\PimcoreAdminListener:
        tags:
            - { name: kernel.event_listener, event: pimcore.bundle_manager.paths.css, method: addCSSFiles }
            - { name: kernel.event_listener, event: pimcore.bundle_manager.paths.js, method: addJSFiles }
            - { name: kernel.event_listener, event: pimcore.admin.resolve.elementAdminStyle, method: onResolveElementAdminStyle }

    # checkout listeners for ecommerce application
#    App\EventListener\CheckoutEventListener:
#        tags:
#            - { name: kernel.event_listener, event: pimcore.ecommerce.ordermanager.postUpdateOrder, method: onUpdateOrder }
#            - { name: kernel.event_listener, event: pimcore.ecommerce.commitorderprocessor.sendConfirmationMails, method: sendConfirmationMail }
#            - { name: kernel.event_listener, event: pimcore.ecommerce.commitorderprocessor.postCommitOrder, method: postCommitOrder }

    # authentication login listener for updating e-commerce framework environment after login
#    App\EventListener\AuthenticationLoginListener:
#        arguments:
#            $httpUtils: '@security.http_utils'

    # authentication login listener for updating e-commerce framework environment after logout
#    App\EventListener\AuthenticationLogoutListener:
#        arguments:
#            $httpUtils: '@security.http_utils'




    # ---------------------------------------------------------
    # Workflow
    # ---------------------------------------------------------
    App\Workflow\SupportsStrategy: ~

demo_frontendセクションをコメントアウトまたは削除。

config/packages/security.yaml

security:
    firewalls:
        # demo_frontend: ---> delete this section
            ..........
            .............

管理画面のファイルマネージャで必要のないコントローラも削除すること。


不必要なコンポーネントを削除

composer.json

  "require": {
    "hwi/oauth-bundle": "^1.2.0", ---> delete
    "php-http/guzzle7-adapter": "^0.1.1",
    "php-http/httplug-bundle": "^1",
    "pimcore/customer-management-framework-bundle": "^3.0",---> delete
    "pimcore/data-hub": "^1.0",
    "pimcore/payment-provider-unzer": "^1.0",
    "pimcore/pimcore": "^10.0",
    "pimcore/web2print-tools-bundle": "^4.0",---> delete
    "symfony/google-mailer": "^5.3"
  },
  "conflict": {
    "hwi/oauth-bundle": "1.4.0"---> delete
  },

アップデートとディレクトリ所有者修正

# COMPOSER_MEMORY_LIMIT=-1 composer update
# chown -R www-data:www-data ./

Pimcore PHPコマンド

bin/console list

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display help for the given command. When no command is given display help for the list command
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi|--no-ansi           Force (or disable --no-ansi) ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --ignore-maintenance-mode  Set this flag to force execution in maintenance mode
      --maintenance-mode         Set this flag to force maintenance mode while this task runs
  -e, --env=ENV                  The Environment name. [default: "prod"]
      --no-debug                 Switch off debug mode.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                                      Display information about the current project
  completion                                 Dump the shell completion script
  help                                       Display help for a command
  list                                       List commands
 app
  app:asset-copyright                        
  app:data-command                           
 assets
  assets:install                             Install bundle's web assets under a public directory
 cache
  cache:clear                                Clear the cache
  cache:pool:clear                           Clear cache pools
  cache:pool:delete                          Delete an item from a cache pool
  cache:pool:list                            List available cache pools
  cache:pool:prune                           Prune cache pools
  cache:warmup                               Warm up an empty cache
 config
  config:dump-reference                      Dump the default configuration for an extension
 dbal
  dbal:run-sql                               Executes arbitrary SQL directly from the command line.
 debug
  debug:autowiring                           List classes/interfaces you can use for autowiring
  debug:config                               Dump the current configuration for an extension
  debug:container                            Display current services for an application
  debug:dotenv                               Lists all dotenv files with variables and values
  debug:event-dispatcher                     Display configured listeners for an application
  debug:firewall                             Display information about your security firewall(s)
  debug:form                                 Display form type information
  debug:messenger                            List messages you can dispatch using the message buses
  debug:router                               Display current routes for an application
  debug:translation                          Display translation messages information
  debug:twig                                 Show a list of twig functions, filters, globals and tests
  debug:validator                            Display validation constraints for classes
 doctrine
  doctrine:database:create                   Creates the configured database
  doctrine:database:drop                     Drops the configured database
  doctrine:database:import                   Import SQL file(s) directly to Database.
  doctrine:migrations:current                [current] Outputs the current version
  doctrine:migrations:diff                   [diff] Generate a migration by comparing your current database to your mapping information.
  doctrine:migrations:dump-schema            [dump-schema] Dump the schema for your database to a migration.
  doctrine:migrations:execute                [execute] Execute one or more migration versions up or down manually.
  doctrine:migrations:generate               [generate] Generate a blank migration class.
  doctrine:migrations:latest                 [latest] Outputs the latest version
  doctrine:migrations:list                   [list-migrations] Display a list of all available migrations and their status.
  doctrine:migrations:migrate                [migrate] Execute a migration to a specified version or the latest available version.
  doctrine:migrations:rollup                 [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists.
  doctrine:migrations:status                 [status] View the status of a set of migrations.
  doctrine:migrations:sync-metadata-storage  [sync-metadata-storage] Ensures that the metadata storage is at the latest version.
  doctrine:migrations:up-to-date             [up-to-date] Tells you if your schema is up-to-date.
  doctrine:migrations:version                [version] Manually add and delete migration versions from the version table.
  doctrine:query:sql                         Executes arbitrary SQL directly from the command line.
 fos
  fos:js-routing:debug                       Displays currently exposed routes for an application
  fos:js-routing:dump                        Dumps exposed routes to the filesystem
 lint
  lint:container                             Ensure that arguments injected into services match type declarations
  lint:twig                                  Lint a Twig template and outputs encountered errors
  lint:xliff                                 Lint an XLIFF file and outputs encountered errors
  lint:yaml                                  Lint a YAML file and outputs encountered errors
 messenger
  messenger:consume                          Consume messages
  messenger:setup-transports                 Prepare the required infrastructure for the transport
  messenger:stop-workers                     Stop workers after their current message
 pimcore
  pimcore:bundle:disable                     Disables a bundle
  pimcore:bundle:enable                      Enables a bundle
  pimcore:bundle:install                     Installs a bundle
  pimcore:bundle:list                        Lists all pimcore bundles and their enabled/installed state
  pimcore:bundle:uninstall                   Uninstalls a bundle
  pimcore:cache:clear                        Clear caches
  pimcore:cache:warming                      Warm up caches
  pimcore:classificationstore:delete-store   [classificationstore:delete-store] Delete Classification Store
  pimcore:definition:import:class            [definition:import:class] Import Class definition from a JSON export
  pimcore:definition:import:customlayout     [definition:import:customlayout] Import Customlayout definition from a JSON export
  pimcore:definition:import:fieldcollection  [definition:import:fieldcollection] Import FieldCollection definition from a JSON export
  pimcore:definition:import:objectbrick      [definition:import:objectbrick] Import ObjectBrick definition from a JSON export
  pimcore:deployment:classes-rebuild         [deployment:classes-rebuild] rebuilds db structure for classes, field collections and object bricks based on updated var/classes/definition_*.php files
  pimcore:deployment:custom-layouts-rebuild  rebuilds db structure for custom layouts based on updated var/classes/customlayouts/definition_*.php files
  pimcore:documents:generate-page-previews   Generates the previews shown in the tree on hover
  pimcore:documents:generate-static-pages    Regenerate static pages
  pimcore:documents:migrate-elements         Migrates document elements to editables. See issue https://github.com/pimcore/pimcore/issues/7384 first
  pimcore:email:cleanup                      [email:cleanup] Cleanup email logs
  pimcore:image:low-quality-preview          [pimcore:image:svg-preview] Regenerates low quality image previews for all image assets
  pimcore:locale:delete-unused-tables        Delete unused locale(invalid language) tables & views
  pimcore:maintenance                        [maintenance] Asynchronous maintenance jobs of pimcore (needs to be set up as cron job)
  pimcore:maintenance-mode                   Enable or disable maintenance mode
  pimcore:migrate:storage                    Migrate data from one storage to another
  pimcore:mysql-tools                        [mysql-tools] Optimize and warmup mysql database
  pimcore:recyclebin:cleanup                 Cleanup recyclebin entries
  pimcore:run-script                         Run a specific PHP script in an initialized Pimcore environment
  pimcore:search-backend-reindex             [search-backend-reindex] Re-indexes the backend search of pimcore
  pimcore:system:requirements:check          [system:requirements:check] Check system requirements
  pimcore:thumbnails:clear                   Clear certain image or video thumbnails (temp. files)
  pimcore:thumbnails:image                   [thumbnails:image] Generate image thumbnails, useful to pre-generate thumbnails in the background
  pimcore:thumbnails:optimize-images         [thumbnails:optimize-images] Optimize filesize of all thumbnails
  pimcore:thumbnails:video                   [thumbnails:video] Generate video thumbnails, useful to pre-generate thumbnails in the background
  pimcore:user:reset-password                [reset-password] Reset a user's password
  pimcore:workflow:dump                      Dump a workflow
 presta
  presta:sitemaps:dump                       Dumps sitemaps to given location
 router
  router:match                               Help debug routes by simulating a path info match
 secrets
  secrets:decrypt-to-local                   Decrypt all secrets and stores them in the local vault
  secrets:encrypt-from-local                 Encrypt all local secrets to the vault
  secrets:generate-keys                      Generate new encryption keys
  secrets:list                               List all secrets
  secrets:remove                             Remove a secret from the vault
  secrets:set                                Set a secret in the vault
 security
  security:encode-password                   Encode a password
  security:hash-password                     Hash a user password
 translation
  translation:extract                        [translation:update] Extract missing translations keys from code to translation files.
  translation:pull                           Pull translations from a given provider.
  translation:push                           Push translations to a given provider.

ex)

# bin/console messenger:consume --memory-limit=128M
# bin/console pimcore:maintenance --async
# bin/console messenger:consume pimcore_core pimcore_maintenance --time-limit=300 
# bin/console doctrine:migrations:list
# bin/console debug:router

パフォーマンスガイド

Document -> Settings -> Static Page Generator

Static-Page-Generator

https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Performance_Guide.html#page_Static-Page-Generator

Pimcore offers a static page generator service, which generates static HTML files out of pages (documents). These static files can be delivered directly by Apache/Nginx instead of going through complete PHP driven MVC cycle on a frontend request. This feature is not recommended for a page with dynamic content i.e. news listing, product pages, and so on, where content changes frequently.

サードパーティ製バンドルの追加について

https://pimcore.com/docs/pimcore/current/Development_Documentation/Extending_Pimcore/Add_Your_Own_Dependencies_and_Packages.html#page_Third-party-bundles

composer.json にバンドルを追加してアップデートするか、以下コマンドでインストール

# composer require mtdowling/cron-expression

src/Kernel.php

<?php

namespace App;

use Pimcore\HttpKernel\BundleCollection\BundleCollection;
use Pimcore\Kernel as PimcoreKernel;

class Kernel extends PimcoreKernel
{
    /**
     * Adds bundles to register to the bundle collection. The collection is able
     * to handle priorities and environment specific bundles.
     *
     * @param BundleCollection $collection
     */
    public function registerBundlesToCollection(BundleCollection $collection)
    {
        if (class_exists('\\XYZBundle\\XYZBundle')) {
            $collection->addBundle(new \XYZBundle\XYZBundle);
        }

        // add a custom third-party bundle here with a high priority and only for dev environment
        $collection->addBundle(new Third\Party\PartyBundle, 10, ['dev']);
    }
}