本文整理汇总了PHP中Doctrine_Table::getTypeOf方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Table::getTypeOf方法的具体用法?PHP Doctrine_Table::getTypeOf怎么用?PHP Doctrine_Table::getTypeOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Table
的用法示例。
在下文中一共展示了Doctrine_Table::getTypeOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseValue
public function parseValue($value, Doctrine_Table $table = null, $field = null)
{
if (substr($value, 0, 1) == '(') {
// trim brackets
$trimmed = $this->_tokenizer->bracketTrim($value);
if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') {
// subquery found
$q = new Doctrine_Query();
$value = '(' . $this->query->createSubquery()->parseQuery($trimmed, false)->getQuery() . ')';
} elseif (substr($trimmed, 0, 4) == 'SQL:') {
$value = '(' . substr($trimmed, 4) . ')';
} else {
// simple in expression found
$e = $this->_tokenizer->sqlExplode($trimmed, ',');
$value = array();
$index = false;
foreach ($e as $part) {
if (isset($table) && isset($field)) {
$index = $table->enumIndex($field, trim($part, "'"));
}
if ($index !== false) {
$value[] = $index;
} else {
$value[] = $this->parseLiteralValue($part);
}
}
$value = '(' . implode(', ', $value) . ')';
}
} else {
if (substr($value, 0, 1) == ':' || $value === '?') {
// placeholder found
if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') {
$this->query->addEnumParam($value, $table, $field);
} else {
$this->query->addEnumParam($value, null, null);
}
} else {
$enumIndex = false;
if (isset($table) && isset($field)) {
// check if value is enumerated value
$enumIndex = $table->enumIndex($field, trim($value, "'"));
}
if ($enumIndex !== false) {
$value = $enumIndex;
} else {
$value = $this->parseLiteralValue($value);
}
}
}
return $value;
}