本文整理汇总了PHP中Propel\Generator\Model\Column::getTypeHint方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getTypeHint方法的具体用法?PHP Column::getTypeHint怎么用?PHP Column::getTypeHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Column
的用法示例。
在下文中一共展示了Column::getTypeHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTranslatedColumnSetter
protected function addTranslatedColumnSetter(Column $column)
{
$visibility = $column->getTable()->isReadOnly() ? 'protected' : $column->getMutatorVisibility();
$typeHint = '';
$null = '';
if ($column->getTypeHint()) {
$typeHint = $column->getTypeHint();
if ('array' !== $typeHint) {
$typeHint = $this->declareClass($typeHint);
}
$typeHint .= ' ';
if (!$column->isNotNull()) {
$null = ' = null';
}
}
$typeHint = "{$typeHint}\$v{$null}";
$i18nTablePhpName = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($this->behavior->getI18nTable()));
$tablePhpName = $this->builder->getObjectClassName();
$objectBuilder = $this->builder->getNewObjectBuilder($this->behavior->getI18nTable());
$comment = '';
if ($this->isDateType($column->getType())) {
$objectBuilder->addTemporalMutatorComment($comment, $column);
} else {
$objectBuilder->addMutatorComment($comment, $column);
}
$comment = preg_replace('/^\\t/m', '', $comment);
$comment = str_replace('@return $this|' . $i18nTablePhpName, '@return $this|' . $tablePhpName, $comment);
return $this->renderTemplate('objectTranslatedColumnSetter', ['comment' => $comment, 'column' => $column, 'visibility' => $visibility, 'typeHint' => $typeHint, 'columnPhpName' => $column->getPhpName(), 'localeColumnName' => $this->behavior->getLocaleColumn()->getPhpName()]);
}
示例2: addMutatorOpenOpen
/**
* Adds the mutator function declaration.
*
* @param string &$script
* @param Column $column
*/
public function addMutatorOpenOpen(&$script, Column $column)
{
$cfc = $column->getPhpName();
$visibility = $this->getTable()->isReadOnly() ? 'protected' : $column->getMutatorVisibility();
$typeHint = '';
$null = '';
if ($column->getTypeHint()) {
$typeHint = $column->getTypeHint();
if ('array' !== $typeHint) {
$typeHint = $this->declareClass($typeHint);
}
$typeHint .= ' ';
if (!$column->isNotNull()) {
$null = ' = null';
}
}
$script .= "\n " . $visibility . " function set{$cfc}({$typeHint}\$v{$null})\n {";
}