示例#1
0
 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('extref', 'Graviton\\DocumentBundle\\Types\\ExtReference');
     $this->doubles['router'] = $this->getMockBuilder('\\Symfony\\Bundle\\FrameworkBundle\\Routing\\Router')->disableOriginalConstructor()->setMethods(array('getRouteCollection', 'generate'))->getMock();
     $this->doubles['collection'] = $this->getMockBuilder('\\Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteCollection')->setMethods(array('all'))->getMock();
     $this->doubles['routes'] = [new Route('/core/app/{id}', ['_controller' => 'graviton.core.controller.app:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+']), new Route('/core/app', ['_controller' => 'graviton.core.controller.app.appAction', '_format' => '~'], ['_method' => 'GET']), new Route('/i18n/language/{id}', ['_controller' => 'graviton.i18n.controller.language:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+']), new Route('/hans/showcase/{id}', ['_controller' => 'gravitondyn.showcase.controller.showcase:getAction', '_format' => '~'], ['_method' => 'GET', 'id' => '[a-zA-Z0-9\\-_\\/]+'])];
 }
 /**
  * Register cuctom doctrine types
  */
 public function __construct()
 {
     if (class_exists('\\Doctrine\\ODM\\MongoDB\\Types\\Type')) {
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITIES_TYPE, 'Pim\\Bundle\\CatalogBundle\\MongoDB\\Type\\Entities');
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITY_TYPE, 'Pim\\Bundle\\CatalogBundle\\MongoDB\\Type\\Entity');
     }
 }
 /**
  * Register custom doctrine types
  */
 public function __construct()
 {
     if (class_exists('\\Doctrine\\ODM\\MongoDB\\Types\\Type')) {
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITIES_TYPE, 'Akeneo\\Bundle\\StorageUtilsBundle\\Doctrine\\MongoDBODM\\Types\\Entities');
         \Doctrine\ODM\MongoDB\Types\Type::registerType(self::ODM_ENTITY_TYPE, 'Akeneo\\Bundle\\StorageUtilsBundle\\Doctrine\\MongoDBODM\\Types\\Entity');
     }
 }
 /**
  * initialize bundle
  */
 public function __construct()
 {
     // TODO: implement ExtReferenceArrayType
     Type::registerType('extref', Types\ExtReferenceType::class);
     Type::registerType('hash', Types\HashType::class);
     Type::registerType('hasharray', Types\HashArrayType::class);
     Type::registerType('datearray', Types\DateArrayType::class);
 }
示例#5
0
 /**
  * @param ClassMetadata $classMetadata
  */
 protected function checkCoordinateType(ClassMetadata $classMetadata)
 {
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         if (isset($mapping['cubiche:coordinate'])) {
             $type = 'Coordinate';
             if (!Type::hasType($type)) {
                 Type::registerType($type, CoordinateType::class);
             }
             $classMetadata->fieldMappings[$fieldName]['type'] = $type;
         }
     }
 }
示例#6
0
 /**
  * @param ClassMetadata $classMetadata
  *
  * @throws MappingException
  */
 protected function checkIdType(ClassMetadata $classMetadata)
 {
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         if (isset($mapping['cubiche:id'])) {
             $idMapping = $mapping['cubiche:id'];
             $type = str_replace('\\', '.', $idMapping['type']);
             if (!Type::hasType($type)) {
                 Type::registerType($type, DynamicIdType::class);
                 Type::getType($type)->setTargetClass($idMapping['type']);
             }
             $classMetadata->fieldMappings[$fieldName]['type'] = $type;
         }
     }
 }
示例#7
0
 /**
  * @param ClassMetadata $classMetadata
  */
 protected function checkTypes(ClassMetadata $classMetadata)
 {
     $types = array_keys($this->typeMapping);
     foreach ($classMetadata->fieldMappings as $fieldName => $mapping) {
         foreach ($types as $type) {
             if (isset($mapping['cubiche:' . $type])) {
                 $typeName = substr($this->typeMapping[$type], strrpos($this->typeMapping[$type], '\\') + 1);
                 if (!Type::hasType($typeName)) {
                     Type::registerType($typeName, $this->typeMapping[$type]);
                 }
                 $classMetadata->fieldMappings[$fieldName]['type'] = $typeName;
                 break;
             }
         }
     }
 }
 public function bootstrapDoctrine(MvcEvent $event)
 {
     $serviceManager = $event->getApplication()->getServiceManager();
     /** @var Options\ModuleOptions $moduleOptions */
     $moduleOptions = $serviceManager->get(__NAMESPACE__ . '\\Options\\ModuleOptions');
     if ($moduleOptions->getDoctrine()->registerUuidType()) {
         if (!class_exists('Rhumsaa\\Uuid\\Uuid')) {
             throw new Exception\RuntimeException('Failed to register "uuid" Doctrine mapping type: ' . 'Missing required class Rhumsaa\\Uuid\\Uuid');
         }
         if (class_exists(DoctrineOrmTypes\Type::CLASS)) {
             DoctrineOrmTypes\Type::addType(DoctrineUuidType::NAME, DoctrineUuidType::CLASS);
         }
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmUuidType::NAME, DoctrineOdmUuidType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeImmutableType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeImmutType::NAME, DoctrineOdmDateTimeImmutType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeNoTzType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeNoTzType::NAME, DoctrineOdmDateTimeNoTzType::CLASS);
         }
     }
     if ($moduleOptions->getDoctrine()->registerDatetimeImmutableNoTzType()) {
         if (class_exists(DoctrineOdmTypes\Type::CLASS)) {
             DoctrineOdmTypes\Type::registerType(DoctrineOdmDateTimeImmutNoTzType::NAME, DoctrineOdmDateTimeImmutNoTzType::CLASS);
         }
     }
     //        /** @var \Zend\ServiceManager\ServiceManager $serviceManager */
     //        $serviceManager = $event->getApplication()->getServiceManager();
     //
     //        /** @var \Doctrine\ORM\EntityManager $entityManager */
     //        $entityManager = $serviceManager->get('Doctrine\ORM\EntityManager');
     //        $entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('db_mytype', 'mytype');
 }
示例#9
0
 public function __construct()
 {
     Type::registerType('dough_money', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughMoneyType');
 }
示例#10
0
 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('extref', ExtReferenceType::class);
     $this->type = Type::getType('extref');
 }
示例#11
0
 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('datearray', DateArrayType::class);
     $this->type = Type::getType('datearray');
 }
 public function __construct()
 {
     Type::registerType('date', 'Staffim\\TimestampableBundle\\MongoDB\\Type\\DateType');
 }
示例#13
0
 public function __construct()
 {
     Type::registerType('dough_currency_money', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughCurrencyMoneyType');
     Type::registerType('dough_currency_money_hash', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughCurrencyMoneyHashType');
 }
示例#14
0
 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('hash', 'Graviton\\DocumentBundle\\Types\\HashType');
     $this->type = Type::getType('hash');
 }
 /**
  * initialize bundle
  */
 public function __construct()
 {
     Type::registerType('extref', 'Graviton\\DocumentBundle\\Types\\ExtReference');
 }
示例#16
0
 /**
  * setup type we want to test
  *
  * @return void
  */
 public function setUp()
 {
     Type::registerType('hasharray', HashArrayType::class);
     $this->type = Type::getType('hasharray');
 }