Skip to content

Commit

Permalink
Add phpdoc ColumnSchema. (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Mar 5, 2023
1 parent ff63f75 commit 73f94aa
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions src/ColumnSchema.php
Expand Up @@ -13,20 +13,40 @@
use function json_decode;

/**
* The class ColumnSchema for Mysql database.
* Represents the metadata of a column in a database table for Mysql, MariaDb Server. It provides information about the
* column's name, type, size, precision, and other details.
*
* Is used to store and retrieve metadata about a column in a database table. It is typically used in conjunction with
* the TableSchema class, which represents the metadata of a database table as a whole.
*
* Here is an example of how the ColumnSchema class might be used:
*
* ```php
* use Yiisoft\Db\Mysql\ColumnSchema;
*
* $column = new ColumnSchema();
* $column->name('id');
* $column->allowNull(false);
* $column->dbType('int(11)');
* $column->phpType('integer');
* $column->type('integer');
* $column->defaultValue(0);
* $column->autoIncrement(true);
* $column->primaryKey(true);
* ```
*/
final class ColumnSchema extends AbstractColumnSchema
{
/**
* Converts the input value according to {@see phpType} after retrieval from the database.
*
* If the value is null or an {@see Expression}, it will not be converted.
* If the value is `null` or an {@see \Yiisoft\Db\Expression\Expression}, it will not be converted.
*
* @param mixed $value input value.
* @param mixed $value The value to be converted.
*
* @throws JsonException
* @throws JsonException If the value cannot be decoded.
*
* @return mixed converted value.
* @return mixed The converted value.
*/
public function phpTypecast(mixed $value): mixed
{
Expand All @@ -44,12 +64,12 @@ public function phpTypecast(mixed $value): mixed
/**
* Converts the input value according to {@see type} and {@see dbType} for use in a db query.
*
* If the value is null or an {@see Expression}, it will not be converted.
* If the value is `null` or an {@see \Yiisoft\Db\Expression\Expression}, it will not be converted.
*
* @param mixed $value input value.
* @param mixed $value The value to be converted.
*
* @return mixed converted value. This may also be an array containing the value as the first element and the PDO
* type as the second element.
* @return mixed The converted value. This may also be an array containing the value as the first element and the
* PDO type as the second element.
*/
public function dbTypecast(mixed $value): mixed
{
Expand Down

0 comments on commit 73f94aa

Please sign in to comment.