This topic contains 2 replies, has 1 voice, and was last updated by duyanguk 6 years ago.
- Topic
Hi guys,
I’m trying to an enum field to my own bundle:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748<?phpnamespace Tv\Bundle\OrderBundle\Migrations\Data\ORM;use Doctrine\Common\DataFixtures\FixtureInterface;use Doctrine\Common\Persistence\ObjectManager;use Oro\Bundle\ContactBundle\Entity\Contact;use Oro\Bundle\ContactBundle\Entity\Source;use Oro\Bundle\EntityExtendBundle\Entity\Repository\EnumValueRepository;use Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper;/*** Class LoadSources** @package AppBundle\Migrations\Data\ORM*/class LoadOrderStatus implements FixtureInterface{/*** @var array*/protected $data = ['open' => 'open','closed' => 'closed'];/*** @param ObjectManager $manager** @throws \InvalidArgumentException*/public function load(ObjectManager $manager){$className = ExtendHelper::buildEnumValueClassName('order_status');/** @var EnumValueRepository $enumRepo */$enumRepo = $manager->getRepository($className);$priority = 1;foreach ($this->data as $name => $isDefault) {$enumOption = $enumRepo->createEnumValue($name, $priority++, $isDefault);$manager->persist($enumOption);}$manager->flush();}}12345678910111213141516171819202122232425262728293031323334353637383940414243444546<?phpnamespace Tv\Bundle\OrderBundle\Migrations\Schema\V2_6;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension;use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;class AddStatusToOrder implements Migration, ExtendExtensionAwareInterface{/*** @var ExtendExtension*/private $extendExtension;/*** @param ExtendExtension $extendExtension*/public function setExtendExtension(ExtendExtension $extendExtension){$this->extendExtension = $extendExtension;}/*** @param Schema $schema* @param QueryBag $queries*/public function up(Schema $schema, QueryBag $queries){$table = $schema->getTable('tv_order');$this->extendExtension->addEnumField($schema,$table,'stat','order_status',false,false,['extend' => ['owner' => ExtendScope::OWNER_CUSTOM, 'without_default' => true]]);}}I run php app/console oro:entity-extend:update-config and php app/console oro:entity-extend:update-schema,
php app/console oro:entity-extend:cache:clear –no-warmup
Then I run php app/console oro:migration:load –forceBut when I run app/console oro:migration:load:data. it says Class ‘Extend\Entity\EV_Order_Status’ does not exist. I guess it’s not generated.
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.