This topic contains 3 replies, has 2 voices, and was last updated by Robin Straub 6 years, 6 months ago.
- Topic
1. Application related information:
Application Type: OroCRM
Application Version: 2.4
Application Edition: Community2. Environment related information:
OS, name and version: OSX 10.12.6
Web server, name and version: Apache/2.4.25
Database, name and version: MySQL/5.7.19
PHP, version: 7.1.83. Issue
I have to link items to an opportunity. Thus I wrote migrations to :- create a custom entity (Vehicle) with some basic fields (id, vin, description and link)
- add a ManyToMany relation between Opportunity and Vehicle (following this github doc)
I am doing a reinstall (“php app/console oro:install –drop-database”), I get the following error
12[RuntimeException]Cannot find entity for "oro_ext_vehicle" table.This error happens when the install script runs the command “oro:entity-extend:migration:update-config”.
I managed to get through this error by disabling the migration for the ManyToMany relation, and executing it in a second time. The relation seems to work as the database is updated accordingly, but the website interface doesn’t show any changes.
My questions
How do I fix the migrations not working when executed together?
How do I enable my ManyToMany relation in the website interface, so I can add vehicles in an opportunity (I managed to do so by adding the relation from the interface “Add Field” tool, but I need to set it in the code so it can be deployed in production without manual configuration).Additional informations
Vehicule migration
12345678910111213141516171819202122232425262728293031323334public function up(Schema $schema, QueryBag $queries){$table = $schema->createTable('oro_ext_vehicle');$table->addColumn('id', 'integer', ['autoincrement' => true]);$table->addColumn('vin','integer',array('oro_options' => array('extend' => array('is_extend' => true, 'owner' => ExtendScope::OWNER_CUSTOM),'datagrid' => array('is_visible' => true),'merge' => array('display' => true),)));$table->addColumn('description','string',array('oro_options' => array('extend' => array('is_extend' => true, 'owner' => ExtendScope::OWNER_CUSTOM),'datagrid' => array('is_visible' => true),'merge' => array('display' => true),)));$table->addColumn('link','string',array('oro_options' => array('extend' => array('is_extend' => true, 'owner' => ExtendScope::OWNER_CUSTOM),'datagrid' => array('is_visible' => true),'merge' => array('display' => true),)));$table->setPrimaryKey(['id']);}Relation migration
12345678910111213141516171819202122232425public function up(Schema $schema, QueryBag $queries){$this->extendExtension->addManyToManyRelation($schema,'orocrm_sales_opportunity','vehicles','oro_ext_vehicle',['description'],['description'],['description'],['extend' => ['owner'=> ExtendScope::OWNER_CUSTOM, 'without_default' => true]]);$this->extendExtension->addManyToManyInverseRelation($schema,'orocrm_sales_opportunity','vehicles','oro_ext_vehicle','opportunities',['name'],['name'],['name'],['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]);}Vehicule entity
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384/*** @ORM\Entity* @ORM\Table(name="oro_ext_vehicle")*/class Vehicle{/*** @ORM\Id* @ORM\Column(type="integer")* @ORM\GeneratedValue(strategy="AUTO")*/private $id;/*** @ORM\Column(type="integer")*/private $vin;/*** @ORM\Column(type="string")*/private $description;/*** @ORM\Column(type="string")*/private $link;/*** @return mixed*/public function getId(){return $this->id;}/*** @return mixed*/public function getVin(){return $this->vin;}/*** @param mixed $vin*/public function setVin($vin){$this->vin = $vin;}/*** @return mixed*/public function getDescription(){return $this->description;}/*** @param mixed $description*/public function setDescription($description){$this->description = $description;}/*** @return mixed*/public function getLink(){return $this->link;}/*** @param mixed $link*/public function setLink($link){$this->link = $link;}}Please let me know if you need additional informations.
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.