Changed name to append(), fixed phpdoc, added changelog

This commit is contained in:
Alexander Makarov
2016-05-13 15:56:33 +03:00
parent 66eabda770
commit 27866bf9d6
5 changed files with 25 additions and 27 deletions

View File

@ -56,10 +56,10 @@ class ColumnSchemaBuilder extends Object
*/ */
protected $default; protected $default;
/** /**
* @var mixed SQL string to be appended to column schema string. * @var mixed SQL string to be appended to column schema definition.
* @since 2.0.8 * @since 2.0.8
*/ */
protected $plus; protected $append;
/** /**
* @var boolean whether the column values should be unsigned. If this is `true`, an `UNSIGNED` keyword will be added. * @var boolean whether the column values should be unsigned. If this is `true`, an `UNSIGNED` keyword will be added.
* @since 2.0.7 * @since 2.0.7
@ -245,11 +245,11 @@ class ColumnSchemaBuilder extends Object
* Specify additional SQL to be appended to schema string. * Specify additional SQL to be appended to schema string.
* @param string $sql the SQL string to be appended. * @param string $sql the SQL string to be appended.
* @return $this * @return $this
* @since 2.0.8 * @since 2.0.9
*/ */
public function plus($sql) public function plus($sql)
{ {
$this->plus = $sql; $this->append = $sql;
return $this; return $this;
} }
@ -261,10 +261,10 @@ class ColumnSchemaBuilder extends Object
{ {
switch ($this->getTypeCategory()) { switch ($this->getTypeCategory()) {
case self::CATEGORY_PK: case self::CATEGORY_PK:
$format = '{type}{check}{comment}{plus}'; $format = '{type}{check}{comment}{append}';
break; break;
default: default:
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{plus}'; $format = '{type}{length}{notnull}{unique}{default}{check}{comment}{append}';
} }
return $this->buildCompleteString($format); return $this->buildCompleteString($format);
} }
@ -374,13 +374,13 @@ class ColumnSchemaBuilder extends Object
} }
/** /**
* Builds the first constraint for the column. Defaults to unsupported. * Builds the custom string that's appended to column definition.
* @return string a string containing the FIRST constraint. * @return string custom string to append.
* @since 2.0.8 * @since 2.0.9
*/ */
protected function buildPlusString() protected function buildAppendString()
{ {
return $this->plus !== null ? ' ' . $this->plus : ''; return $this->append !== null ? ' ' . $this->append : '';
} }
/** /**
@ -420,10 +420,8 @@ class ColumnSchemaBuilder extends Object
'{default}' => $this->buildDefaultString(), '{default}' => $this->buildDefaultString(),
'{check}' => $this->buildCheckString(), '{check}' => $this->buildCheckString(),
'{comment}' => $this->buildCommentString(), '{comment}' => $this->buildCommentString(),
'{pos}' => ($this->isFirst) ? '{pos}' => $this->isFirst ? $this->buildFirstString() : $this->buildAfterString(),
$this->buildFirstString() : '{append}' => $this->buildAppendString(),
$this->buildAfterString(),
'{plus}' => $this->buildPlusString(),
]; ];
return strtr($format, $placeholderValues); return strtr($format, $placeholderValues);
} }

View File

@ -58,13 +58,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
{ {
switch ($this->getTypeCategory()) { switch ($this->getTypeCategory()) {
case self::CATEGORY_PK: case self::CATEGORY_PK:
$format = '{type}{check}{pos}{comment}{plus}'; $format = '{type}{check}{pos}{comment}{append}';
break; break;
case self::CATEGORY_NUMERIC: case self::CATEGORY_NUMERIC:
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{plus}'; $format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{append}';
break; break;
default: default:
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{plus}'; $format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{append}';
} }
return $this->buildCompleteString($format); return $this->buildCompleteString($format);
} }

View File

@ -58,13 +58,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
{ {
switch ($this->getTypeCategory()) { switch ($this->getTypeCategory()) {
case self::CATEGORY_PK: case self::CATEGORY_PK:
$format = '{type}{length}{check}{comment}{pos}{plus}'; $format = '{type}{length}{check}{comment}{pos}{append}';
break; break;
case self::CATEGORY_NUMERIC: case self::CATEGORY_NUMERIC:
$format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{plus}'; $format = '{type}{length}{unsigned}{notnull}{unique}{default}{check}{comment}{pos}{append}';
break; break;
default: default:
$format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{plus}'; $format = '{type}{length}{notnull}{unique}{default}{check}{comment}{pos}{append}';
} }
return $this->buildCompleteString($format); return $this->buildCompleteString($format);
} }

View File

@ -51,13 +51,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
{ {
switch ($this->getTypeCategory()) { switch ($this->getTypeCategory()) {
case self::CATEGORY_PK: case self::CATEGORY_PK:
$format = '{type}{length}{check}{pos}{plus}'; $format = '{type}{length}{check}{pos}{append}';
break; break;
case self::CATEGORY_NUMERIC: case self::CATEGORY_NUMERIC:
$format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{plus}'; $format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{append}';
break; break;
default: default:
$format = '{type}{length}{default}{notnull}{check}{pos}{plus}'; $format = '{type}{length}{default}{notnull}{check}{pos}{append}';
} }
return $this->buildCompleteString($format); return $this->buildCompleteString($format);
} }

View File

@ -33,13 +33,13 @@ class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
{ {
switch ($this->getTypeCategory()) { switch ($this->getTypeCategory()) {
case self::CATEGORY_PK: case self::CATEGORY_PK:
$format = '{type}{check}{plus}'; $format = '{type}{check}{append}';
break; break;
case self::CATEGORY_NUMERIC: case self::CATEGORY_NUMERIC:
$format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{plus}'; $format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}';
break; break;
default: default:
$format = '{type}{length}{notnull}{unique}{check}{default}{plus}'; $format = '{type}{length}{notnull}{unique}{check}{default}{append}';
} }
return $this->buildCompleteString($format); return $this->buildCompleteString($format);