This topic contains 0 replies, has 1 voice, and was last updated by aliaksandra.chyrkova 6 years, 10 months ago.
- Topic
Hi all,
I have following case. There is a need to import Main_Entity with has some relations to other entities.
When the relation is many-to-one, everything works perfect, however, one relation is more complex. One of the fields of Main_entity is an entity that has its own three identity fields.What is the best way to set up such import?
Is it possible just to use @ConfigField (tried but was not successful)? Or should I extend Processor? Or should I extend FieldHelper? Or should I pass Doctrine Queries somewhere?Below some code examples so that the structure be more obvuois.
Converter:12345678910protected function getHeaderConversionRules(){return ['Description' => 'corporateDescription', // string field'Manufacturer' => 'range:manufacturer:name', //part of Range_entity'Class' => 'range:class:name', //part of Range_entity'Bodyshell' => 'range:bodyShell:name', //part of Range_entity'Fuel' => 'fuel:name' // many-to-one (just identity field of related entity)];}Main_entity:
12345678910111213141516171819202122232425262728293031323334/*** @var string** @ORM\Column(name="corporate_description", type="text")* @ConfigField(* defaultValues={* "importexport"={* "full"=true* }* }* )*/private $corporateDescription;/*** @var VehicleFuel** @ORM\ManyToOne(targetEntity="VehicleFuel")* @ORM\JoinColumn(name="fuel_id", referencedColumnName="id", onDelete="SET NULL")* @ConfigField(* defaultValues={* "importexport"={* "full"=true* }* }* )*/private $fuel;/*** @var VehicleRange** @ORM\ManyToOne(targetEntity="VehicleRange")* @ORM\JoinColumn(name="vehicle_range_id", referencedColumnName="id", onDelete="SET NULL")*/private $range;VehicleFuel
12345678910111213/*** @var string** @ORM\Column(name="name", type="string", length=50)* @ConfigField(* defaultValues={* "importexport"={* "identity"=true* }* }* )*/private $name;Range (all related entities (Manufacturer, Class and BodyShell) are confured with “identity”=true for property $name:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162/*** VehicleRange** @ORM\Table(name="vehicle_range")* @ORM\Entity(readOnly=true)* @Config*/class VehicleRange{/*** @var int** @ORM\Column(name="id", type="integer")* @ORM\Id* @ORM\GeneratedValue(strategy="AUTO")*/private $id;/*** @var VehicleManufacturer** @ORM\ManyToOne(targetEntity="VehicleManufacturer")* @ORM\JoinColumn(name="manufacturer_id", referencedColumnName="id", onDelete="SET NULL")* @ConfigField(* defaultValues={* "importexport"={* "identity"=true* }* }* )*/private $manufacturer;/*** @var VehicleClass** @ORM\ManyToOne(targetEntity="VehicleClass")* @ORM\JoinColumn(name="class_id", referencedColumnName="id", onDelete="SET NULL")* @ConfigField(* defaultValues={* "importexport"={* "identity"=true* }* }* )*/private $class;/*** @var VehicleBodyShell** @ORM\ManyToOne(targetEntity="VehicleBodyShell")* @ORM\JoinColumn(name="body_shell_id", referencedColumnName="id", onDelete="SET NULL")* @ConfigField(* defaultValues={* "importexport"={* "identity"=true* }* }* )*/private $bodyShell;
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.