本文整理汇总了PHP中Doctrine\ODM\MongoDB\Types\Type::registerType方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::registerType方法的具体用法?PHP Type::registerType怎么用?PHP Type::registerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ODM\MongoDB\Types\Type
的用法示例。
在下文中一共展示了Type::registerType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* 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\\-_\\/]+'])];
}
示例2: __construct
/**
* 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');
}
}
示例3: __construct
/**
* 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');
}
}
示例4: __construct
/**
* 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: checkCoordinateType
/**
* @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: checkIdType
/**
* @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: checkTypes
/**
* @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;
}
}
}
}
示例8: bootstrapDoctrine
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: __construct
public function __construct()
{
Type::registerType('dough_money', 'Dough\\Doctrine\\ODM\\MongoDB\\Type\\DoughMoneyType');
}
示例10: setUp
/**
* setup type we want to test
*
* @return void
*/
public function setUp()
{
Type::registerType('extref', ExtReferenceType::class);
$this->type = Type::getType('extref');
}
示例11: setUp
/**
* setup type we want to test
*
* @return void
*/
public function setUp()
{
Type::registerType('datearray', DateArrayType::class);
$this->type = Type::getType('datearray');
}
示例12: __construct
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');
}
示例13: setUp
/**
* setup type we want to test
*
* @return void
*/
public function setUp()
{
Type::registerType('hash', 'Graviton\\DocumentBundle\\Types\\HashType');
$this->type = Type::getType('hash');
}
示例14: __construct
/**
* initialize bundle
*/
public function __construct()
{
Type::registerType('extref', 'Graviton\\DocumentBundle\\Types\\ExtReference');
}
示例15: setUp
/**
* setup type we want to test
*
* @return void
*/
public function setUp()
{
Type::registerType('hasharray', HashArrayType::class);
$this->type = Type::getType('hasharray');
}