This topic contains 4 replies, has 3 voices, and was last updated by Mike Kudelya 6 years, 10 months ago.
- Topic
Hi,
I am trying to create a field in user entity that have an one to one relationship with contacts.
How do I do this? This is my migration file. But this is not an extend script. No getters or setters are generated. How do I
12345678910111213141516171819202122232425262728293031323334353637383940<?php/*** Created by PhpStorm.* User: jake* Date: 27/1/17* Time: 1:07 PM*/namespace CampusCRM\CampusUserBundle\Migrations\Schema\v1_1;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;class ExtendContactEntity implements Migration, ExtendExtensionAwareInterface{protected $extendExtension;public function setExtendExtension(ExtendExtension $extendExtension){$this->extendExtension = $extendExtension;}public function up(Schema $schema, QueryBag $queries){$table = $schema->getTable('oro_user');$table->addColumn('contact_id', 'integer', ['notnull' => false]);$table->addIndex(['contact_id'], 'IDX_212163ZA11578Q45', []);$table->addForeignKeyConstraint($schema->getTable('orocrm_contact'),['contact_id'],['id'],['onDelete' => 'SET NULL', 'onUpdate' => null]);}}
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.