youwe/pimcore-object-bridge

Allows editing an object inline that doesn't link directly many-to-many like

Installs: 6 159

Dependents: 1

Suggesters: 0

Security: 0

Stars: 7

Watchers: 9

Forks: 6

Open Issues: 0

Language:JavaScript

Type:pimcore-bundle


README

Use advanced many to one object relation instead.

Object bridge field

Allows editing an object inline that doesn't link directly many-to-many like Example: MainObject -> BridgeObject -> SourceObject allows to edit inline BridgeObject after linking a source object to it Cart -> ProductItem -> Product

How to install

  1. Run composer require youwe/pimcore-object-bridge to receive the bundle
  2. Enable the bundle bin/console pimcore:bundle:enable ObjectBridgeBundle
  3. Then the field objectBridge should be available in field selector under relations (Add Data Component->Relation->objectBridge)

Allowed in:

  • object: true,
  • objectbrick: true,
  • fieldcollection: true,
  • localizedfield: true,
  • classificationstore: false,
  • block: true

Bridge object editing fields:

  • numeric
  • input
  • select
  • manyToOneRelation
  • checkbox

If not in list above then field will be read-only

Field specific settings

Source class
Select which class should be used as primary class
Source visible fields
Which fields from source class should be displayed
Bridge class
Select which class should be created when selecting the source object
Bridge visible fields
Same as source fields but from bridge class
Bridge field
Which field should be used when linking source object to bridge object
Bridge folder
Where bridge objects should be stored after automatic creating
Limitation: When many to one relation is used, there can only be one class type linked. First one will be used.

Example scenario

        +--------------+             +--------------+
        |              |             |              |
        |    Garage    |             |    Garage    |
        |              |             |              |
        +-+-----------++             +----+---------+
          |           |                   |
          |           |                   |
          |           |                   |
+---------+---+    +--+----------+   +----+--------+
|             |    |             |   |             |
|  GarageCar  |    |  GarageCar  |   |  GarageCar  |
|             |    |             |   |             |
+---------+---+    +--+----------+   +----+--------+
          |           |                   |
          |           |     +-------------+
          |           |     |
+---------+---+    +--+-----+----+
|             |    |             |
|     Car     |    |     Car     |
|             |    |             |
+-------------+    +-------------+

In this example, you would add the ObjectBridge field to Garage. The bridge table would be GarageCar. GarageCar would have a (single) many to one relation field to Car.

Fields for example tables:

Garage

  • name
  • location
  • garageCars (field type = object-bridge)

GarageCar

  • totalQuantity
  • availableQuantity
  • car (field type = manyToOneRelation)

Car

  • type
  • brand
  • price

A certain car can be present in multiple garages, in different quantities.

See object bulk dump structure here

Screenshot

Screenshot of the bridge

Todo's:

  • Option to add custom add new object window (now default add functionality)
  • Default value
  • Testing