本文整理汇总了PHP中Propel\Generator\Model\Column::getLowercasedName方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getLowercasedName方法的具体用法?PHP Column::getLowercasedName怎么用?PHP Column::getLowercasedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Column
的用法示例。
在下文中一共展示了Column::getLowercasedName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addBooleanMutator
/**
* Change default propel behaviour
*
* Adds setter method for boolean columns.
*
* @see \Propel\Generator\Builder\Om\ObjectBuilder::addColumnMutators()
*
* @param string &$script The script will be modified in this method.
* @param \Propel\Generator\Model\Column $col The current column.
*
* @return void
*/
protected function addBooleanMutator(&$script, Column $col)
{
$clo = $col->getLowercasedName();
$this->addBooleanMutatorComment($script, $col);
$this->addMutatorOpenOpen($script, $col);
$this->addMutatorOpenBody($script, $col);
$allowNullValues = $col->getAttribute('required', 'true') === 'true' ? 'false' : 'true';
$script .= "\n if (\$v !== null) {\n if (is_string(\$v)) {\n \$v = in_array(strtolower(\$v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;\n } else {\n \$v = (bool) \$v;\n }\n }\n\n \$allowNullValues = {$allowNullValues};\n\n if (\$v === null && !\$allowNullValues) {\n return \$this;\n }\n\n if (\$this->{$clo} !== \$v) {\n \$this->{$clo} = \$v;\n \$this->modifiedColumns[" . $this->getColumnConstant($col) . '] = true;
}
';
$this->addMutatorClose($script, $col);
}
示例2: addDefaultMutator
/**
* Adds setter method for "normal" columns.
* @param string &$script The script will be modified in this method.
* @param Column $col The current column.
* @see parent::addColumnMutators()
*/
protected function addDefaultMutator(&$script, Column $col)
{
$clo = $col->getLowercasedName();
$this->addMutatorOpen($script, $col);
// Perform type-casting to ensure that we can use type-sensitive
// checking in mutators.
if ($col->isPhpPrimitiveType()) {
$script .= "\n if (\$v !== null) {\n \$v = (" . $col->getPhpType() . ") \$v;\n }\n";
}
$script .= "\n if (\$this->{$clo} !== \$v) {\n \$this->{$clo} = \$v;\n \$this->modifiedColumns[" . $this->getColumnConstant($col) . "] = true;\n }\n";
$this->addMutatorClose($script, $col);
}