本文整理匯總了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);
}