承接 basilicom/pimcore-path-formatter-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

basilicom/pimcore-path-formatter-bundle

Composer 安装命令:

composer require basilicom/pimcore-path-formatter-bundle

包简介

This bundle provides path formatter pattern configuration for Pimcore DataObjects in multi-relation.

README 文档

README

Usecase / Summary

If you want to display specific information of a DataObject when it's listed in a relation-field (Many-to-Many, Many-to-One, Advanced Many-to-Many, etc.), you can use this bundle to easily configure a display pattern.

Instead of creating a new PathFormatter PHP class for every specific display requirement (e.g., showing the name, price, and currency of a product), you can simply define patterns in your configuration.

# config/packages/basilicom_path_formatter.yaml
basilicom_path_formatter:
  pattern: 
    Pimcore\Model\DataObject\Product: "{name} {price}{currency}"   

You can also define specific pattern overwrites for a class when it is referenced in a specific field of another class:

# config/packages/basilicom_path_formatter.yaml
basilicom_path_formatter:
  pattern: 
    Pimcore\Model\DataObject\Product: "{name} {price}{currency}" # global product format
    Pimcore\Model\DataObject\ProductList::products: 
       patternOverwrites:
          Pimcore\Model\DataObject\Product: "#{id} {name}"

While the product will be formatted like Sneakers 19.99EUR in most relation-fields, the products field in the ProductList class will show them like #13 Sneakers.

Version information

Bundle Version PHP Pimcore
^1.0 ^7.3 ^6.0
^2.0 ^8.0 ^10.0
^3.0 ^8.1 ^11.0

Installation

  1. Install the bundle using composer:

    composer require basilicom/pimcore-path-formatter-bundle
  2. Enable the bundle:

    • Pimcore >= 10: The bundle should be automatically registered. If not, add it to config/bundles.php.
    • Pimcore < 10: Add the following to AppKernel::registerBundlesToCollection():
      if (class_exists('\\Basilicom\\PathFormatterBundle\\BasilicomPathFormatterBundle')) {
            $collection->addBundle(new \Basilicom\PathFormatterBundle\BasilicomPathFormatterBundle);
      }

Configuration

  1. Create a configuration file (e.g., config/packages/basilicom_path_formatter.yaml).
  2. Configure your patterns using the full qualified class names as keys.

Basic Configuration

Use curly brackets {} to reference class properties. Any property accessible via a public getter (e.g., {name} calls getName()) can be used.

basilicom_path_formatter:
  pattern: 
    # Output example: "Product: Sneakers (/dataObject/Products/Sneakers)"
    Pimcore\Model\DataObject\Product: "Product: {name} ({fullPath})" 

Nested Properties

The bundle supports nested property access using dot notation. For example, if a Product has a Category, and you want to show the category name:

basilicom_path_formatter:
  pattern: 
    Pimcore\Model\DataObject\Product: "{name} (Category: {category.name})" 

Note: This will call $product->getCategory()->getName().

Contextual Pattern Overwrites

You can override patterns based on the context (the parent object and the specific field).

basilicom_path_formatter:
  pattern:
    # Global default
    Pimcore\Model\DataObject\Product: "{name}"

    # Overwrite when a Product is shown in the 'featuredProducts' field of a Category object
    Pimcore\Model\DataObject\Category::featuredProducts:
      patternOverwrites:
        Pimcore\Model\DataObject\Product: "FEATURED: {name} ({price})"

Formatting Documents and Assets

The formatter is not limited to DataObjects; it also works for Assets and Documents.

basilicom_path_formatter:
  pattern:
    Pimcore\Model\Asset: "{id} {filename}"
    Pimcore\Model\Document: "{id} {key}"

Additional Features

Inheritance in DataObjects

By default, inherited values are used when resolving placeholders. You can disable this globally:

basilicom_path_formatter:
  enable_inheritance: false # default: true

Asset Previews

If a referenced property resolves to a Pimcore\Model\Asset\Image, the bundle automatically renders a small preview thumbnail in the relation list.

basilicom_path_formatter:
  enable_asset_preview: true # default: true
  pattern:
    Pimcore\Model\DataObject\Product: "{mainImage} {name}"

If the target element itself is an Asset\Image, a preview is also prepended to the pattern.

Usage in Pimcore Admin

To apply the formatter to a field:

  1. Open your Class Definition.
  2. Select a relation field (e.g., Many-to-Many Relation).
  3. In the Formatter input field, enter the service ID: @Basilicom\PathFormatterBundle\DependencyInjection\BasilicomPathFormatter

Author: Alexander Heidrich (Basilicom GmbH)
License: GPL v3

basilicom/pimcore-path-formatter-bundle 适用场景与选型建议

basilicom/pimcore-path-formatter-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47.2k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pimcore」 「path formatter」 「pathformatter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 basilicom/pimcore-path-formatter-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 basilicom/pimcore-path-formatter-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 basilicom/pimcore-path-formatter-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 47.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-09-10