I made some headway.

I've added my new type after working our how to get the EntityManager in 
Zf2 - 

<code>
$serviceManager = $e->getApplication()->getServiceManager();
        $entityManager = 
$e->getApplication()->getServiceManager()->get('Doctrine\ORM\EntityManager');
        
        Type::addType('geometry', 'Assets\Types\Geometry');
     
       // $entityManager = $e->getApplication()->getEntityManager();
        $conn = $entityManager->getConnection();
        $conn->getDatabasePlatform()->registerDoctrineTypeMapping('geom', 
'geometry');
</code>

In onBootstrap(MvcEvent $e)  
in Module.php

I am trying to generate entities using:

<CMD>
php ./vendor/doctrine/doctrine-module/bin/doctrine-module.php 
 orm:convert-mapping --namespace="Assets\\Entity\\" --force 
 --from-database annotation ./module/Assets/src/
</CMD>

and I still get :

<output>


  [Doctrine\DBAL\DBALException]
  Unknown database type geometry requested, 
Doctrine\DBAL\Platforms\SQLServer2008Platform may not support it.

</output>

Can I register my geometry type in the core of Doctrine rather than in the 
Applicaiton code or is there a better way of doing this?

Is it possible?

Any help greatly appreciated - I think the PM is getting nervous.

Stay well,
Barry



On Tuesday, 15 April 2014 16:41:33 UTC+10, Barry Steele wrote:
>
> Hi,
> I'm using Doctrine 2 and Zend Framework 2 to build a number of 
> applications.
>
> As part of that I need to add a customer data type - I've built the class 
> but (following 
> http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html)
> but I don't really understand this bit:
>
> "To convert the underlying database type of your new “mytype” directly 
> into an instance of MyType when performing schema operations, the type has 
> to be registered with the database platform as well:
>
> <?php
> $conn = $em->getConnection();
> $conn->getDatabasePlatform()->registerDoctrineTypeMapping('db_mytype', 
> 'mytype');
>
> Is this also part of the bootstrap?  Or where does it go if I need to be 
> able to use the data type from the command line.
>
> Thanks in advance.
> Barry
>

On Tuesday, 15 April 2014 16:41:33 UTC+10, Barry Steele wrote:
>
> Hi,
> I'm using Doctrine 2 and Zend Framework 2 to build a number of 
> applications.
>
> As part of that I need to add a customer data type - I've built the class 
> but (following 
> http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html)
> but I don't really understand this bit:
>
> "To convert the underlying database type of your new “mytype” directly 
> into an instance of MyType when performing schema operations, the type has 
> to be registered with the database platform as well:
>
> <?php
> $conn = $em->getConnection();
> $conn->getDatabasePlatform()->registerDoctrineTypeMapping('db_mytype', 
> 'mytype');
>
> Is this also part of the bootstrap?  Or where does it go if I need to be 
> able to use the data type from the command line.
>
> Thanks in advance.
> Barry
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to