Pimcore(Symfony+Twig)開発ティップス

Pimcoreアップグレートに伴うブラッシュアップ

Link Generator
https://pimcore.com/docs/pimcore/current/Development_Documentation/Objects/Object_Classes/Class_Settings/Link_Generator.html#page_Link-Generator

Pimcore Twig Extensions(Template Extensions)
https://pimcore.com/docs/pimcore/current/Development_Documentation/MVC/Template/Template_Extensions/index.html#page_Pimcore-Twig-Extensions

Symfony(PHP Framework)

Twig(PHP Template Engine)

Pimcore Forum

Newsオブジェクトを参照してBlogオブジェクトを作成後、Newsリストのページから詳細ページへのロードエラー発生(NewsコントローラではなくBlogコントローラを読み込んでしまう)

以下 BlogController.php 内のリンク先URLのフォーマットを見直し。

BlogController.php
~b{blog}

@Route("{path}/{blogtitle}~b{blog}", name="blog-detail", defaults={"path"=""}, requirements={"path"=".*?", "blogtitle"="[\w-]+", "blog"="\d+"})

NewsController.php
~n{news}

@Route("{path}/{newstitle}~n{news}", name="news-detail", defaults={"path"=""}, requirements={"path"=".*?", "newstitle"="[\w-]+", "news"="\d+"})

Using Param Converter to convert request ID to Data Object

https://pimcore.com/docs/pimcore/current/Development_Documentation/MVC/Routing_and_URLs/Custom_Routes.html#page_Using-Param-Converter-to-convert-request-ID-to-Data-Object

Symfony @ParamConverter

PimcoreSymfonyフレームワークにより構築されているため、Routeに関しては以下の Routing, @ParamConverter も参照のこと

Routing

@ParamConverter

Symfony5

Twigテンプレートからコントローラ(ファンクション)の呼出し

EX)

コントローラ

// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Component\HttpFoundation\Response;
// ...

class BlogController extends AbstractController
{
    public function recentArticles(int $max = 3): Response
    {
        // get the recent articles somehow (e.g. making a database query)
        $articles = ['...', '...', '...'];

        return $this->render('blog/_recent_articles.html.twig', [
            'articles' => $articles
        ]);
    }
}

上記コントローラの recentArticles で指定したTwigテンプレート

{# templates/blog/_recent_articles.html.twig #}
{% for article in articles %}
    <a href="{{ path('blog_show', {slug: article.slug}) }}">
        {{ article.title }}
    </a>
{% endfor %}

他のTwigテンプレートから上記コントローラの呼出し
{{ render(controller( 'App\\Controller\\BlogController::recentArticles', {max: 3} )) }}

{# templates/base.html.twig #}

{# ... #}
<div id="sidebar">
    {# if the controller is associated with a route, use the path() or url() functions #}
    {{ render(path('latest_articles', {max: 3})) }}
    {{ render(url('latest_articles', {max: 3})) }}

    {# if you don't want to expose the controller with a public URL,
       use the controller() function to define the controller to execute #}
    {{ render(controller(
        'App\\Controller\\BlogController::recentArticles', {max: 3}
    )) }}
</div>

Pimcore Select

https://pimcore.com/docs/pimcore/current/Development_Documentation/Documents/Editables/Select.html

ブログとニュースのリストアップスニペットをPHPからTwigテンプレートへ変更

templates/snippets/footer-sammary.html.twig

{% if editmode %}
    <style type="text/css">
        .teaser {
            max-width: 250px;
        }

        .teaser img {
            max-width: 100%;
        }
    </style>

    <h3>How many News titles should be listed? (default:1):</h3>
    {{ pimcore_select('newsTitles', {
        width: 70,
        reload: true,
        store: [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],
        class: 'align-middle'
    }) }}

    <br />
    <hr />

    <h3>How many Blog titles should be listed? (default:1):</h3>
    {{ pimcore_select('blogTitles', {
        width: 70,
        reload: true,
        store: [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],
        class: 'align-middle'
    }) }}

{% else %}
    <div class="panel-heading pb-4">
        <h4 class="card-title text-light">{{ 'Information'|trans }}</h4>
    </div>

    {% set count = pimcore_select('newsTitles').getData() %}
    {% if count is empty or count == 0 %}
        {% set count = 1 %}
    {% endif %}
    {{ render(controller(
        'App\\Controller\\NewsController::titleListAction', { 'items': '(int) $count' }
    )) }}

    {% set count = pimcore_select('blogTitles').getData() %}
    {% if count is empty or count == 0 %}
        {% set count = 1 %}
    {% endif %}
    {{ render(controller(
        'App\\Controller\\BlogController::titleListAction', { 'items': '(int) $count' }
    )) }}

{% endif %}

Snippet内でのLink Generator

SidebarやFooter内でNewsやBlog記事をリストアップするSnippetを作成した際、以下のSnippetメソッドエラー発生。

An exception has been thrown during the rendering of a template (“Call to undefined method getTitle in class Pimcore\Model\Document\Snippet”).

Link GeneratorでSnippetのディレクトリ shared/teasers を読み込まないよう以下修正。
editmode時は除外、document時のみ適用)

Website/LinkGenerator/NewsLinkGenerator.php

.....
.....
/* if($document && !$fullPath) { */
if($document) {
$fullPath = $document->getProperty('news_default_document') ? substr($document->getProperty('news_default_document')->getFullPath(), strlen($localeUrlPart)) : '';
} 
.....
.....

Website/LinkGenerator/BlogLinkGenerator.php

.....
.....
/* if($document && !$fullPath) { */
if($document) {
$fullPath = $document->getProperty('blog_default_document') ? substr($document->getProperty('blog_default_document')->getFullPath(), strlen($localeUrlPart)) : '';
}
.....
.....

news_default_document, blog_default_document は以下の Predefined Proparties で定義後、任意の DocumentNavigation&PropertiesNewsとBlogリストページのパスを指定すること。

Predefined Proparties

Navigation&Properties

Twig文字制限

Twig length

Twig slice

{{ myentity.text[:50] ~ (myentity.text|length > 50 ? '…') }}

補足:省略記号 ellipsis character ‘…’
スリードット ... ではなく1つのキャラクターとして を表示

注)Linux:Ubuntuの場合(MAC,Windowsではキーが異なります)

  1. Ctrl + Shift + ‘u’ 押下
  2. キーリリース
  3. 続けて"2026"を入力,
  4. エンターキー押下

Twig dump

テンプレート内の変数確認

<pre>
    {{ dump(item) }}
</pre>
Pimcore\Model\DataObject\Fieldcollection\Data\NewsText {#2378 ▼
  #type: "NewsText"
  #localizedfields: Pimcore\Model\DataObject\Localizedfield {#2384 ▶}
  #index: 0
  #fieldname: "content"
  #object: null
  #objectId: 1158
  #dao: null
  #_fulldump: false
  #loadedLazyKeys: []
  #o_dirtyFields: null
  type: "NewsText"
  localizedfields: Pimcore\Model\DataObject\Localizedfield {#2384 ▶}
  index: 0
  fieldname: "content"
  object: null
  objectId: 1158
  _fulldump: false
  loadedLazyKeys: []
  o_dirtyFields: null
}

Twig striptags

htmlテキストファイルから <p>,<br> 等のタグを除外

EX) テキストソース頭から200文字を抽出後タグを削除。文字数が200文字を超えていたら '…' による省略記号追加。

{% if news.content %}
    {% for item in news.content.items %}
        {% if item.type == "NewsText" %}
            {{ item.text[:200] | striptags ~ (item.text|length > 200 ? '…') }}
        {% endif %}   
    {% endfor %}
{% endif %}

Twig Replace

上記のタグ削除に non-breaking space &nbsp;" "への置換え追加
non-breaking spaceは、単位と数値の間の改行禁止のスペース

  • § 10
  • 10 km/h
  • 10 PM
{% if news.content %}
    {% for item in news.content.items %}
        {% if item.type == "NewsText" %}
            {{ item.text[:200] | striptags | replace({'&nbsp;': " "}) ~ (item.text|length > 200 ? '…') }}
        {% endif %}   
    {% endfor %}
{% endif %}

Twig Operators

条件設定

  • ?:: The ternary operator:
{{ foo ? 'yes' : 'no' }}
{{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }}
{{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }}

Twig Logic

論理条件定義

  • and: Returns true if the left and the right operands are both true.
  • or: Returns true if the left or the right operand is true.
  • not: Negates a statement.
  • (expr): Groups an expression.

Twig Date

日付表示

Twig date_modify

{{ post.published_at|date_modify("+1 day")|date("m/d/Y") }}

Twig path

{{ path(route_name, route_parameters = [], relative = false) }}

name

type: string

parameters (optional)

type: array default: []

relative (optional)

type: boolean default: false

Returns the relative URL (without the scheme and host) for the given route. If relative is enabled, it’ll create a path relative to the current path.

Link Generatorで使用するTextクラスの漢字のローマ字変換について

以下問題と同様、リンクURLに日本語タイトルを挿入する際、ひらがなカナの読み方は正しくローマ字に変換されるが、漢字についてはピンインの読みとなってしまう。

漢字の日本語読みは複数のため、Latin規格に取り込まれていない模様。

Link Generator(Blog)

Website/LinkGenerator/BlogLinkGenerator.php

'blogtitle' => Text::toUrl($object->getTitle() ? $object->getTitle() : 'blog'),

Textクラス

Website/Tool/Text.php

public static function toUrl($text)
    {
        // to ASCII
        $text = trim(transliterator_transliterate('Any-Latin; Latin-ASCII; [^\u001F-\u007f] remove', $text));

        $search = ['?', '\'', '"', '/', '-', '+', '.', ',', ';', '(', ')', ' ', '&', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß', 'É', 'é', 'È', 'è', 'Ê', 'ê', 'E', 'e', 'Ë', 'ë',
                         'À', 'à', 'Á', 'á', 'Å', 'å', 'a', 'Â', 'â', 'Ã', 'ã', 'ª', 'Æ', 'æ', 'C', 'c', 'Ç', 'ç', 'C', 'c', 'Í', 'í', 'Ì', 'ì', 'Î', 'î', 'Ï', 'ï',
                         'Ó', 'ó', 'Ò', 'ò', 'Ô', 'ô', 'º', 'Õ', 'õ', 'Œ', 'O', 'o', 'Ø', 'ø', 'Ú', 'ú', 'Ù', 'ù', 'Û', 'û', 'U', 'u', 'U', 'u', 'Š', 'š', 'S', 's',
                         'Ž', 'ž', 'Z', 'z', 'Z', 'z', 'L', 'l', 'N', 'n', 'Ñ', 'ñ', '¡', '¿',  'Ÿ', 'ÿ', '_', ':' ];
        $replace = ['', '', '', '', '-', '', '', '-', '-', '', '', '-', '', 'ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e',
                         'A', 'a', 'A', 'a', 'A', 'a', 'a', 'A', 'a', 'A', 'a', 'a', 'AE', 'ae', 'C', 'c', 'C', 'c', 'C', 'c', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i',
                         'O', 'o', 'O', 'o', 'O', 'o', 'o', 'O', 'o', 'OE', 'O', 'o', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'S', 's', 'S', 's',
                         'Z', 'z', 'Z', 'z', 'Z', 'z', 'L', 'l', 'N', 'n', 'N', 'n', '', '', 'Y', 'y', '-', '-' ];

        $value = urlencode(str_replace($search, $replace, $text));

        return $value;
    }

PHP Transliterator::transliterate
https://www.php.net/manual/en/transliterator.transliterate.php

Font-Family

system-ui

指定されたプラットフォームの既定のユーザーインターフェイスフォントからグリフを取ります。文字の伝統は世界で様々であるため、この総称は他の総称にきれいに一致しない文字フォントを提供します。

PImcore(Symfony)のデバッグモード

https://pimcore.com/docs/pimcore/current/Development_Documentation/Development_Tools_and_Details/Debugging.html

.env ファイルにより、SymfonyによるデバックとPimcoreによるデバックを別々に設定可能です。

Symfonyによるデバックモード

APP_ENV=dev

)Symfonyのデバックモードの場合、サイト下部にデバックメニューが表示されるため、本番環境移行の際にはSymfonyのデバックモードを無効にする必要があります。

APP_ENV=prod

Pimcoreによるデバックモード

PIMCORE_DEV_MODE=true

Logging ログファイル

PimcoreまたはSymfonyにより作成されるログファイルは project/var/log に作成・保存されます。
各ログファイルは7日間アーカイブ保存されますが、Symfonyのデバックモード有効時(APP_ENV=dev)のDEVログファイルは1日のアーカイブ容量が数百MBを浪費するため注意が必要です。

Logging-Pimcore
https://pimcore.com/docs/pimcore/current/Development_Documentation/Development_Tools_and_Details/Logging.html

Symfony Logging

File Permissions

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

パーミッションと bin フォルダ内スクリプト実行権の付与

$ sudo chown -R YOURUSER:YOURGROUP var public/var
$ sudo chmod ug+x bin/*

Symfony

サイトマップ (Sitemaps)

Pimcore Sitemaps
https://pimcore.com/docs/pimcore/current/Development_Documentation/Tools_and_Features/Sitemaps.html

GitHubドキュメント
https://github.com/pimcore/pimcore/blob/10.x/doc/Development_Documentation/18_Tools_and_Features/39_Sitemaps.md

PrestaSitemap
https://github.com/prestaconcept/PrestaSitemapBundle/blob/master/Resources/doc/1-installation.md

vendor/presta フォルダーに以下のパッケージがない場合にインストール

$ composer require presta/sitemap-bundle

config/bundles.php に以下追加

<?php
return [
    //...
    Presta\SitemapBundle\PrestaSitemapBundle::class => ['all' => true],
];

上記パッケージの設定ファイルをインポート
config/routes/presta_sitemap.yaml

presta_sitemap:
    resource: "@PrestaSitemapBundle/Resources/config/routing.yml"
    prefix:   /

キャッシュクリアと所有権修復

# bin/console cache:clear
# chown -R www-data:www-data ./

サイトマップのアウトプット

# bin/console presta:sitemaps:dump --base-url=https://ficus.myvnc.com/
Dumping all sections of sitemaps into public directory
Created/Updated the following sitemap files:
    sitemap.default.xml
    sitemap.xml

robots.txtの作成

About /robots.txt
https://www.robotstxt.org/robotstxt.html

global.cssの変更

/public/static/css/global.css

表示サイズ変更時の不具合

新規オブジェクト内で定義したwysiwygによるテキスト要素内で追加した画像サイズが、携帯モードにしてもそのまま。
ウェブページ表示内の画像サイズを携帯サイズの幅にも対応させるため global.css に以下追加。

.main-content img {
    max-width: 100%;
}

CKEditor Code Snippetの背景カラー

携帯幅サイズへ変更時、カーソルが付与されたセクションでカーソルを右移動すると背景が白のまま(cssでの指定背景色が反映されていない)。
codesnippet指定セクション <pre><code>.....</code></pre>

<pre>セクションで以下指定。

pre {
    display: block;
    padding: 10px;
    margin: 0 0 10.5px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-all;
    word-wrap: break-word;
    color: #7b8a8b;
    background-color: #474948;
    border: 1px solid #ffffff;
    border-radius: 4px;
}

URLの改行

表示幅縮小時の https://............ の改行指定

a {
    overflow-wrap: break-word;
}

overflow-wrap無効時

overflow-wrap有効時

overflow-wrap

word-break

Error Redirect Page

指定URIエラー時のリダイレクト

Error-Pageを作成し、そのディレクトリを指定。

System Settings ---> Website
error_redirect

AWSへ移行時のエラー

500エラー発生。.envでデバックモードへ変更し下記エラー確認。Documentページの読み込みエラー。

PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS(?)' with params [1]:

下記問題と同一

DROP FUNCTION IF EXISTS PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS;
DELIMITER //

CREATE FUNCTION PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS(elementIdent INT) RETURNS TEXT
  READS SQL DATA
  BEGIN
    DECLARE segmentIds TEXT;
    DECLARE elementExists TINYINT;
    DECLARE breaks TINYINT;

    SELECT `segments` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO segmentIds;
    SELECT COUNT(*) FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO elementExists;
    SELECT `breaksInheritance` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO breaks;

    WHILE (elementExists = 0 OR breaks IS NULL OR breaks <> 1) AND elementIdent > 1 DO
      SELECT `parentId`  FROM `documents` WHERE `id` = elementIdent INTO elementIdent;
      SELECT CONCAT_WS(',', segmentIds, (SELECT `segments` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document')) INTO segmentIds;
      SELECT COUNT(*) FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO elementExists;
      SELECT `breaksInheritance` INTO breaks FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document';
    END WHILE;

    RETURN segmentIds;
  END//
DELIMITER ;

上記sqlコマンドをpimcoreのデータベースで実行。

GmailによるMailer設定

Pimcoreで使用するMailerGmailに設定します。

PImcoreEmail Framework
https://pimcore.com/docs/pimcore/current/Development_Documentation/Development_Tools_and_Details/Email_Framework/

参照元:SymfonyMailerに関するドキュメント

以下PImcoreの設定ファイルのMailerの箇所をアンコメントして有効にして下さい。

config/config.yml

#### SYSTEM SETTINGS

    email:
        sender:
            name: 'Ficusonline'
            email: ficus.online@gmail.com
        return:
            name: ''
            email: ''

#### SYMFONY OVERRIDES
framework:

#### SYMFONY MAILER TRANSPORTS
    mailer:
        transports:
            main: '%env(MAILER_DSN)%'

GmailによるMailer設定は、別途 .env ファイルで指定。
.env

MAILER_DSN=gmail+smtp://USERNAME:PASSWORD@default

ComposerGmail Mailerをインストール。

# composer require symfony/google-mailer

最後にPimcoreによるサイトディレクトリのアクセス権 (500error対応) を修復して下さい。

bin/console command

キャッシュクリア

# bin/console cache:clear

キャッシュクリア後はアクセス権を見直すこと。

# chown -R www-data:www-data ./

コマンドオプション一覧

# bin/console
Pimcore 10.0.8 (env: prod, debug: false)

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
  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
 cmf
  cmf:build-segments                                Build automatically calculated segments
  cmf:duplicates-index                              Handles the duplicate search index
  cmf:handle-cron-triggers                          Handle cron triggers cronjob - needs to run once per minute
  cmf:maintenance                                   Performs various tasks configured in services.yml -> 'cmf.maintenance.serviceCalls'
  cmf:process-actiontrigger-queue                   Process entries from action trigger queue
  cmf:segment-assignment-index                      Processes entries from segment assignment queue, use this for manually updating the index, which is usually done during cmf:maintenance
 config
  config:dump-reference                             Dump the default configuration for an extension
 datahub
  datahub:graphql:rebuild-definitions               Rebuild GraphQL endpoint definitions
 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:event-dispatcher                            Display configured listeners for an application
  debug:firewall                                    Display information about your security firewall(s)
  debug:form                                        Display form type information
  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.
 ecommerce
  ecommerce:cleanup-pending-orders                  Cleans up orders with state pending payment after 1h -> delegates this to commit order processor
  ecommerce:indexservice:bootstrap                  Bootstrap tasks creating/updating index (for all tenants), use one of the options --create-or-update-index-structure or --update-index
  ecommerce:indexservice:elasticsearch-sync         Refresh elastic search (ES) index settings, mappings via native ES-API.
  ecommerce:indexservice:process-preparation-queue  Processes the ecommerce preparation queue based on the store table(s).
  ecommerce:indexservice:process-update-queue       Processes the ecommerce queue / store table and updates the (search) index.
  ecommerce:indexservice:reset-queue                Resets the preparation or index-update queue (ONLY NEEDED if store table is out of sync)
  ecommerce:voucher:cleanup-reservations            Cleans the token reservations due to sysConfig duration settings
  ecommerce:voucher:cleanup-statistics              House keeping for Voucher Usage Statistics - cleans up all old data.
 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
 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: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:mysql-tools                               [mysql-tools] Optimize and warmup mysql database
  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:web2print:pdf-creation                    [web2print:pdf-creation] Start pdf creation
  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:pull                                  Pull translations from a given provider.
  translation:push                                  Push translations to a given provider.
  translation:update                                Update the translation file

Pimcore bundleの無効化

以下イーコマース関連のbundleは不要のため無効とする。

  • PimcoreCustomerManagementFrameworkBundle
  • PimcoreEcommerceFrameworkBundle
  • PimcorePaymentProviderUnzerBundle

以下bin/consoleコマンドオプションにてbundleリストを確認後無効化。

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
# ./bin/console pimcore:bundle:list
+------------------------------------------+---------+-----------+-------------+---------------+----------+---+
| Bundle                                   | Enabled | Installed | Installable | Uninstallable | Priority |   |
+------------------------------------------+---------+-----------+-------------+---------------+----------+---+
| PimcoreCustomerManagementFrameworkBundle | ❌       | ❌         | ❌           | ❌             | ❌        | 0 |
| OutputDataConfigToolkitBundle            | ✔       | ❌         | ✔           | ✔             | ✔        |   |
| PimcoreDataHubBundle                     | ✔       | ✔         | ❌           | ❌             | ✔        |   |
| PimcoreEcommerceFrameworkBundle          | ❌       | ❌         | ❌           | ❌             | ❌        | 0 |
| PimcorePaymentProviderUnzerBundle        | ❌       | ❌         | ❌           | ❌             | ❌        | 0 |
| NumberSequenceGeneratorBundle            | ❌       | ❌         | ❌           | ❌             | ❌        | 0 |
| ObjectMergerBundle                       | ✔       | ✔         | ❌           | ❌             | ✔        |   |
| Web2PrintToolsBundle                     | ✔       | ❌         | ✔           | ❌             | ✔        |   |
+------------------------------------------+---------+-----------+-------------+---------------+----------+---+

無効化

# ./bin/console pimcore:bundle:disable PimcorePaymentProviderUnzerBundle

Data Objects 500 Error

バージョン履歴のクリア

phpMyAdminのpimcoreデータベース内で以下sqlコマンド実行

DELETE FROM ###.versions WHERE ctype='asset';

全バージョン履歴のクリア

$ docker exec -ti pimcore10-fpm bash
# cd pimcore10
# ./bin/console pimcore:maintenance -f -j versioncleanup
# rm -r var/versions/object

管理画面エラー

ブラウザの検証メッセージ
pimcore_admin_document_document_doctypesget error on admin

デバックモードへ変更し管理画面へのログイン可否確認後、プロダクションモードへ変更。
キャッシュの不具合によるエラー。

# bin/console clear:cache

bin/console list

bin/console list       
Pimcore 10.0.8 (env: prod, debug: false)

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
  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
 cmf
  cmf:build-segments                                Build automatically calculated segments
  cmf:duplicates-index                              Handles the duplicate search index
  cmf:handle-cron-triggers                          Handle cron triggers cronjob - needs to run once per minute
  cmf:maintenance                                   Performs various tasks configured in services.yml -> 'cmf.maintenance.serviceCalls'
  cmf:process-actiontrigger-queue                   Process entries from action trigger queue
  cmf:segment-assignment-index                      Processes entries from segment assignment queue, use this for manually updating the index, which is usually done during cmf:maintenance
 config
  config:dump-reference                             Dump the default configuration for an extension
 datahub
  datahub:graphql:rebuild-definitions               Rebuild GraphQL endpoint definitions
 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:event-dispatcher                            Display configured listeners for an application
  debug:firewall                                    Display information about your security firewall(s)
  debug:form                                        Display form type information
  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.
 ecommerce
  ecommerce:cleanup-pending-orders                  Cleans up orders with state pending payment after 1h -> delegates this to commit order processor
  ecommerce:indexservice:bootstrap                  Bootstrap tasks creating/updating index (for all tenants), use one of the options --create-or-update-index-structure or --update-index
  ecommerce:indexservice:elasticsearch-sync         Refresh elastic search (ES) index settings, mappings via native ES-API.
  ecommerce:indexservice:process-preparation-queue  Processes the ecommerce preparation queue based on the store table(s).
  ecommerce:indexservice:process-update-queue       Processes the ecommerce queue / store table and updates the (search) index.
  ecommerce:indexservice:reset-queue                Resets the preparation or index-update queue (ONLY NEEDED if store table is out of sync)
  ecommerce:voucher:cleanup-reservations            Cleans the token reservations due to sysConfig duration settings
  ecommerce:voucher:cleanup-statistics              House keeping for Voucher Usage Statistics - cleans up all old data.
 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
 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: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:mysql-tools                               [mysql-tools] Optimize and warmup mysql database
  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:web2print:pdf-creation                    [web2print:pdf-creation] Start pdf creation
  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:pull                                  Pull translations from a given provider.
  translation:push                                  Push translations to a given provider.
  translation:update                                Update the translation file