Skip to content

Bundle that makes a many to many relation with additional data

Notifications You must be signed in to change notification settings

YouweGit/PimcoreObjectBridge

Repository files navigation

Abandoned

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