db layer phpdoc fixes

This commit is contained in:
Carsten Brandt
2016-02-07 16:32:57 +01:00
parent 2505e7ef63
commit e43c41c9ea
8 changed files with 22 additions and 26 deletions

View File

@ -291,15 +291,15 @@ class ActiveRecord extends BaseActiveRecord
*/ */
public static function getTableSchema() public static function getTableSchema()
{ {
$schema = static::getDb() $tableSchema = static::getDb()
->getSchema() ->getSchema()
->getTableSchema(static::tableName()); ->getTableSchema(static::tableName());
if ($schema === null) { if ($tableSchema === null) {
throw new InvalidConfigException('The table does not exist: ' . static::tableName()); throw new InvalidConfigException('The table does not exist: ' . static::tableName());
} }
return $schema; return $tableSchema;
} }
/** /**

View File

@ -48,6 +48,7 @@ class ColumnSchemaBuilder extends Object
protected $default; protected $default;
/** /**
* @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
*/ */
protected $isUnsigned = false; protected $isUnsigned = false;
@ -123,6 +124,7 @@ class ColumnSchemaBuilder extends Object
* Specify the default SQL expression for the column. * Specify the default SQL expression for the column.
* @param string $default the default value expression. * @param string $default the default value expression.
* @return $this * @return $this
* @since 2.0.7
*/ */
public function defaultExpression($default) public function defaultExpression($default)
{ {
@ -223,6 +225,7 @@ class ColumnSchemaBuilder extends Object
/** /**
* Builds the unsigned string for column. * Builds the unsigned string for column.
* @return string a string containing UNSIGNED keyword. * @return string a string containing UNSIGNED keyword.
* @since 2.0.7
*/ */
protected function buildUnsignedString() protected function buildUnsignedString()
{ {

View File

@ -18,8 +18,9 @@ use yii\base\NotSupportedException;
* The SQL statement it represents can be set via the [[sql]] property. * The SQL statement it represents can be set via the [[sql]] property.
* *
* To execute a non-query SQL (such as INSERT, DELETE, UPDATE), call [[execute()]]. * To execute a non-query SQL (such as INSERT, DELETE, UPDATE), call [[execute()]].
* To execute a SQL statement that returns result data set (such as SELECT), * To execute a SQL statement that returns a result data set (such as SELECT),
* use [[queryAll()]], [[queryOne()]], [[queryColumn()]], [[queryScalar()]], or [[query()]]. * use [[queryAll()]], [[queryOne()]], [[queryColumn()]], [[queryScalar()]], or [[query()]].
*
* For example, * For example,
* *
* ```php * ```php
@ -33,7 +34,7 @@ use yii\base\NotSupportedException;
* You may also call [[prepare()]] explicitly to prepare a SQL statement. * You may also call [[prepare()]] explicitly to prepare a SQL statement.
* *
* Command also supports building SQL statements by providing methods such as [[insert()]], * Command also supports building SQL statements by providing methods such as [[insert()]],
* [[update()]], etc. For example, * [[update()]], etc. For example, the following code will create and execute an INSERT SQL statement:
* *
* ```php * ```php
* $connection->createCommand()->insert('user', [ * $connection->createCommand()->insert('user', [
@ -42,9 +43,9 @@ use yii\base\NotSupportedException;
* ])->execute(); * ])->execute();
* ``` * ```
* *
* To build SELECT SQL statements, please use [[QueryBuilder]] instead. * To build SELECT SQL statements, please use [[Query]] instead.
* *
* @see http://www.yiiframework.com/doc-2.0/guide-db-dao.html * For more details and usage information on Command, see the [guide article on Database Access Objects](guide:db-dao).
* *
* @property string $rawSql The raw SQL with parameter values inserted into the corresponding placeholders in * @property string $rawSql The raw SQL with parameter values inserted into the corresponding placeholders in
* [[sql]]. This property is read-only. * [[sql]]. This property is read-only.

View File

@ -35,6 +35,10 @@ use yii\base\Component;
* $rows = $command->queryAll(); * $rows = $command->queryAll();
* ``` * ```
* *
* Query internally uses the [[QueryBuilder]] class to generate the SQL statement.
*
* A more detailed usage guide on how to work with Query can be found in the [guide article on Query Builder](guide:db-query-builder).
*
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0

View File

@ -13,8 +13,9 @@ use yii\base\NotSupportedException;
/** /**
* QueryBuilder builds a SELECT SQL statement based on the specification given as a [[Query]] object. * QueryBuilder builds a SELECT SQL statement based on the specification given as a [[Query]] object.
* *
* QueryBuilder can also be used to build SQL statements such as INSERT, UPDATE, DELETE, CREATE TABLE, * SQL statements are created from [[Query]] objects using the [[build()]]-method.
* from a [[Query]] object. *
* QueryBuilder is also used by [[Command]] to build SQL statements such as INSERT, UPDATE, DELETE, CREATE TABLE.
* *
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0

View File

@ -223,14 +223,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
} }
/** /**
* Builds SQL for IN condition * @inheritdoc
* * @throws NotSupportedException if `$columns` is an array
* @param string $operator
* @param array $columns
* @param Query $values
* @param array $params
* @return string SQL
* @throws NotSupportedException
*/ */
protected function buildSubqueryInCondition($operator, $columns, $values, &$params) protected function buildSubqueryInCondition($operator, $columns, $values, &$params)
{ {

View File

@ -243,7 +243,6 @@ class Schema extends \yii\db\Schema
/** /**
* Collects the foreign key column details for the given table. * Collects the foreign key column details for the given table.
* @param TableSchema $table the table metadata * @param TableSchema $table the table metadata
* @throws \Exception
*/ */
protected function findConstraints($table) protected function findConstraints($table)
{ {

View File

@ -309,14 +309,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
} }
/** /**
* Builds SQL for IN condition * @inheritdoc
* * @throws NotSupportedException if `$columns` is an array
* @param string $operator
* @param array $columns
* @param Query $values
* @param array $params
* @return string SQL
* @throws NotSupportedException
*/ */
protected function buildSubqueryInCondition($operator, $columns, $values, &$params) protected function buildSubqueryInCondition($operator, $columns, $values, &$params)
{ {