Doctrines2的bindValue可以采用哪些类型?

时间:2011-05-20 16:59:43

标签: php doctrine-orm

我很难通过Doctrine的DBAL文档进行导航。我想知道我可以在$ type值中放入什么字符串值:

    bindValue($pointername, $variable, $type);

我在讨论类型的文档中没有找到任何内容。

我正在使用MySQL,所以我想知道我可以在bindValue函数中添加的类型等同于varchartinyint,{{1 }},textdatetimemediumtext

1 个答案:

答案 0 :(得分:2)

根据http://www.doctrine-project.org/api/dbal/2.0/doctrine/dbal/statement.html#bindValue()$type参数可以是PDO类型(请参阅http://au.php.net/manual/en/pdo.constants.php)或dbal映射类型(请参阅http://www.doctrine-project.org/api/dbal/2.0/doctrine/dbal/types/type.html)。

因此,您可以根据事物的外观使用PDO::PARAM_INTDoctrine\DBAL\Types\Type::Integer