This topic contains 2 replies, has 3 voices, and was last updated by msulima 6 years, 2 months ago.
- Topic
Could you please show me how to do this?
What I have done and failed so far (Frontend works and it gets error when saving the form value; the form saves the data if not uploading the image):
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970// Acme\Bundle\AcmeBundle\Entity\Acme(Omitting)/*** @var ArrayCollection** @ORM\ManyToMany(targetEntity="Acme\Bundle\AcmeBundle\Entity\AcmeToImage")* @ORM\JoinTable(name="acme_to_images",* joinColumns={@ORM\JoinColumn(name="image_id", referencedColumnName="id", onDelete="CASCADE")},* inverseJoinColumns={@ORM\JoinColumn(name="id", referencedColumnName="id", onDelete="CASCADE")}* )*/protected $image;(Omitting)public function __construct(){$this->image = new ArrayCollection();}(Omitting)// Acme\Bundle\AcmeBundle\Entity\AcmeToImage(Omitting)/*** @var Acme** @ORM\OneToOne(targetEntity="Oro\Bundle\AttachmentBundle\Entity\Attachment", cascade={"persist"})* @ORM\JoinColumn(name="image_id", referencedColumnName="id", onDelete="CASCADE")* @Oro\Versioned* @ConfigField(* defaultValues={* "merge"={* "display"=true* },* "extend"={* "owner"="SYSTEM",* "is_extend"=true,* "extend"=true,* "target_entity"="Oro\Bundle\AttachmentBundle\Entity\Attachment",* "target_field"="id",* "relation_key"="attachmentImage|Acme\Bundle\AcmeBundle\Entity\AcmeToImage|Oro\Bundle\AttachmentBundle\Entity\Attachment|image"* },* "attachment"={* "maxsize"=20,* "width"=160,* "height"=160* }* }* )**/protected $image;(Omitting)// Acme\Bundle\AcmeBundle\Form\Type\AcmeType(Omitting)$builder->add('image','oro_collection',array('type' => 'oro_image','options' => array('required' => false,'label' => 'Images'),'empty_data' => null,))(Omitting)I also have tried to add the field “$image” via Migration with addFileRelation() and Both ways get:
123Fatal error: Call to undefined method Oro\Bundle\EntityConfigBundle\Config\Id\EntityConfigId::getFieldType() in /(omitting)/vendor/oro/platform/src/Oro/Bundle/AttachmentBundle/Validator/ConfigFileValidator.php on line 64I don’t know if this helps, but I have noticed the field “type” in “oro_entity_config_field” table gets “ref-one” with the 1st way and gets “image” with the 2nd way.
Are we supposed to be able Entity to have the image field type as ArrayCollection?
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.