DDC-2002: [GH-432] Add DBAL\TypeAwareObject type inference. #2680

Open
doctrinebot opened this Issue Aug 29, 2012 · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of Romain-Geissler:

Url: #432

Message:

DBAL allows you to define custom field types for your entities, and those are seamlessly converted from PHP to SQL value. However, you can't those custom types as parameters without type hinting it :

$qb->select('e')
   ->from('Entity', 'e')
   ->where('e.customField = :customFieldValue')
   ->setParameter('customFieldValue',$customFieldValue,$customFieldDBALType);
   //this third argument is for now compulsory
:

In my case, $customFieldValue is an object that won't work well if converted with the default string type. I added a new DBAL interface (see doctrine/dbal#193 ) and tweaked the parameter type inference so that custom values can advertise their DBAL type.

There is currently no way to dynamically override the parameter type inference logic, this is one design that allows it in some cases.

@doctrinebot

Comment created by @beberlei:

A related Github Pull-Request [GH-432] was closed
#432

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-432] was closed:
doctrine/dbal#432

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment