本文整理汇总了PHP中Propel\Generator\Model\Column::getMutatorVisibility方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getMutatorVisibility方法的具体用法?PHP Column::getMutatorVisibility怎么用?PHP Column::getMutatorVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Column
的用法示例。
在下文中一共展示了Column::getMutatorVisibility方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 {";
}
示例3: 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();
$script .= "\n " . $visibility . " function set{$cfc}(\$v)\n {";
}
示例4: addTemporalMutator
/**
* Adds a setter method for date/time/timestamp columns.
* @param string &$script The script will be modified in this method.
* @param Column $col The current column.
* @see parent::addColumnMutators()
*/
protected function addTemporalMutator(&$script, Column $col)
{
$cfc = $col->getPhpName();
$clo = strtolower($col->getName());
$visibility = $col->getMutatorVisibility();
$dateTimeClass = $this->getBuildProperty('dateTimeClass');
if (!$dateTimeClass) {
$dateTimeClass = '\\DateTime';
}
$this->declareClasses($dateTimeClass, '\\DateTimeZone', '\\Propel\\Runtime\\Util\\PropelDateTime');
$this->addTemporalMutatorComment($script, $col);
$this->addMutatorOpenOpen($script, $col);
$this->addMutatorOpenBody($script, $col);
$fmt = var_export($this->getTemporalFormatter($col), true);
$script .= "\n \$dt = PropelDateTime::newInstance(\$v, null, '{$dateTimeClass}');\n if (\$this->{$clo} !== null || \$dt !== null) {";
if (($def = $col->getDefaultValue()) !== null && !$def->isExpression()) {
$defaultValue = $this->getDefaultValueString($col);
$script .= "\n if ( (\$dt != \$this->{$clo}) // normalized values don't match\n || (\$dt->format({$fmt}) === {$defaultValue}) // or the entered value matches the default\n ) {";
} else {
$script .= "\n if (\$dt !== \$this->{$clo}) {";
}
$script .= "\n \$this->{$clo} = \$dt;\n \$this->modifiedColumns[] = " . $this->getColumnConstant($col) . ";\n }\n } // if either are not null\n";
$this->addMutatorClose($script, $col);
}
示例5: testSetMutatorAndAccessorMethodsVisibility
public function testSetMutatorAndAccessorMethodsVisibility()
{
$column = new Column();
$column->setAccessorVisibility('private');
$column->setMutatorVisibility('private');
$this->assertSame('private', $column->getAccessorVisibility());
$this->assertSame('private', $column->getMutatorVisibility());
}
示例6: addMutatorOpenOpen
/**
* Adds the mutator function declaration.
*
* @param string &$script
* @param Column $column
*/
public function addMutatorOpenOpen(&$script, Column $column)
{
$cfc = $column->getPhpName();
$visibility = $column->getMutatorVisibility();
$script .= "\n " . $visibility . " function set{$cfc}(\$v)\n {";
}