LoadOrCreate transformer¶
Creates a new integer entry which contains the id of the loaded or otherwise created entry.
Usage:
<load-or-create
from="price_type"
to="fk_price_type"
>
<load
column="id_price_type"
queryClass="\Orm\Zed\PriceProduct\Persistence\SpyPriceTypeQuery"
by="name"
/>
<create>
<set column="price_mode_configuration" value="BOTH" />
</create>
</load-or-create>
Attributes:
from
- name of the field with the value that should be queried.to
- pipeline field to store found or created id
Children:
- load - the entry from the table
column
- table where the id is storedqueryClass
- query class of the entity to perform the database queryby
- column to be queried by.findOneBy(<by>, <from-value>)
- create - new entry when not found
- set - additonal values to store for the created entry
column
- name of the columnvalue
- value of the column
Optional attributes:
create
- Throws an exception if the entry is not found by the load configuration and create is not provided.