Fixed namespace

This commit is contained in:
huangzhhui 2019-01-23 16:31:35 +08:00
parent 4fda137bb2
commit 5002557073
16 changed files with 171 additions and 147 deletions

View File

@ -20,13 +20,14 @@ use Hyperf\Pagination\Paginator;
use Hyperf\Utils\Arr; use Hyperf\Utils\Arr;
use Hyperf\Utils\Contracts\Arrayable; use Hyperf\Utils\Contracts\Arrayable;
use Hyperf\Utils\Str; use Hyperf\Utils\Str;
use Hyperf\Utils\Traits\ForwardsCalls;
/** /**
* @mixin \Hyperf\Database\Query\Builder * @mixin \Hyperf\Database\Query\Builder
*/ */
class Builder class Builder
{ {
use BuildsQueries, Concerns\QueriesRelationships; use BuildsQueries, ForwardsCalls, Concerns\QueriesRelationships;
/** /**
* The base query builder instance. * The base query builder instance.
@ -722,7 +723,7 @@ class Builder
* *
* @param string $column * @param string $column
* @param string|null $key * @param string|null $key
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
public function pluck($column, $key = null) public function pluck($column, $key = null)
{ {

View File

@ -1109,7 +1109,7 @@ trait HasAttributes
* Return a timestamp as DateTime object with time set to 00:00:00. * Return a timestamp as DateTime object with time set to 00:00:00.
* *
* @param mixed $value * @param mixed $value
* @return \Hyperf\Support\Carbon * @return \Hyperf\Utils\Carbon
*/ */
protected function asDate($value) protected function asDate($value)
{ {
@ -1120,7 +1120,7 @@ trait HasAttributes
* Return a timestamp as DateTime object. * Return a timestamp as DateTime object.
* *
* @param mixed $value * @param mixed $value
* @return \Hyperf\Support\Carbon * @return \Hyperf\Utils\Carbon
*/ */
protected function asDateTime($value) protected function asDateTime($value)
{ {

View File

@ -67,7 +67,7 @@ trait HasTimestamps
/** /**
* Get a fresh timestamp for the model. * Get a fresh timestamp for the model.
* *
* @return \Hyperf\Support\Carbon * @return \Hyperf\Utils\Carbon
*/ */
public function freshTimestamp() public function freshTimestamp()
{ {

View File

@ -256,7 +256,7 @@ class FactoryBuilder
/** /**
* Run after making callbacks on a collection of models. * Run after making callbacks on a collection of models.
* *
* @param \Hyperf\Support\Collection $models * @param \Hyperf\Utils\Collection $models
* @return void * @return void
*/ */
public function callAfterMaking($models) public function callAfterMaking($models)
@ -267,7 +267,7 @@ class FactoryBuilder
/** /**
* Run after creating callbacks on a collection of models. * Run after creating callbacks on a collection of models.
* *
* @param \Hyperf\Support\Collection $models * @param \Hyperf\Utils\Collection $models
* @return void * @return void
*/ */
public function callAfterCreating($models) public function callAfterCreating($models)
@ -278,7 +278,7 @@ class FactoryBuilder
/** /**
* Set the connection name on the results and store them. * Set the connection name on the results and store them.
* *
* @param \Hyperf\Support\Collection $results * @param \Hyperf\Utils\Collection $results
* @return void * @return void
*/ */
protected function store($results) protected function store($results)
@ -418,7 +418,7 @@ class FactoryBuilder
* Call after callbacks for each model and state. * Call after callbacks for each model and state.
* *
* @param array $afterCallbacks * @param array $afterCallbacks
* @param \Hyperf\Support\Collection $models * @param \Hyperf\Utils\Collection $models
* @return void * @return void
*/ */
protected function callAfter(array $afterCallbacks, $models) protected function callAfter(array $afterCallbacks, $models)

View File

@ -15,7 +15,7 @@ use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\ModelNotFoundException; use Hyperf\Database\Model\ModelNotFoundException;
use Hyperf\Support\Str; use Hyperf\Utils\Str;
use InvalidArgumentException; use InvalidArgumentException;
class BelongsToMany extends Relation class BelongsToMany extends Relation
@ -366,7 +366,7 @@ class BelongsToMany extends Relation
* *
* @param mixed $id * @param mixed $id
* @param array $columns * @param array $columns
* @return \Hyperf\Support\Collection|\Hyperf\Database\Model\Model * @return \Hyperf\Utils\Collection|\Hyperf\Database\Model\Model
*/ */
public function findOrNew($id, $columns = ['*']) public function findOrNew($id, $columns = ['*'])
{ {
@ -671,7 +671,7 @@ class BelongsToMany extends Relation
/** /**
* Get all of the IDs for the related models. * Get all of the IDs for the related models.
* *
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
public function allRelatedIds() public function allRelatedIds()
{ {
@ -698,7 +698,7 @@ class BelongsToMany extends Relation
/** /**
* Save an array of new models and attach them to the parent model. * Save an array of new models and attach them to the parent model.
* *
* @param \Hyperf\Support\Collection|array $models * @param \Hyperf\Utils\Collection|array $models
* @param array $pivotAttributes * @param array $pivotAttributes
* @return array * @return array
*/ */

View File

@ -13,7 +13,7 @@ namespace Hyperf\Database\Model\Relations\Concerns;
use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Model;
use Hyperf\Support\Str; use Hyperf\Utils\Str;
trait AsPivot trait AsPivot
{ {

View File

@ -13,7 +13,7 @@ namespace Hyperf\Database\Model\Relations\Concerns;
use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Model;
use Hyperf\Support\Collection as BaseCollection; use Hyperf\Utils\Collection as BaseCollection;
trait InteractsWithPivotTable trait InteractsWithPivotTable
{ {
@ -73,7 +73,7 @@ trait InteractsWithPivotTable
/** /**
* Sync the intermediate tables with a list of IDs without detaching. * Sync the intermediate tables with a list of IDs without detaching.
* *
* @param \Hyperf\Support\Collection|\Hyperf\Database\Model\Model|array $ids * @param \Hyperf\Utils\Collection|\Hyperf\Database\Model\Model|array $ids
* @return array * @return array
*/ */
public function syncWithoutDetaching($ids) public function syncWithoutDetaching($ids)
@ -84,7 +84,7 @@ trait InteractsWithPivotTable
/** /**
* Sync the intermediate tables with a list of IDs or collection of models. * Sync the intermediate tables with a list of IDs or collection of models.
* *
* @param \Hyperf\Support\Collection|\Hyperf\Database\Model\Model|array $ids * @param \Hyperf\Utils\Collection|\Hyperf\Database\Model\Model|array $ids
* @param bool $detaching * @param bool $detaching
* @return array * @return array
*/ */

View File

@ -129,7 +129,7 @@ abstract class HasOneOrMany extends Relation
* *
* @param mixed $id * @param mixed $id
* @param array $columns * @param array $columns
* @return \Hyperf\Support\Collection|\Hyperf\Database\Model\Model * @return \Hyperf\Utils\Collection|\Hyperf\Database\Model\Model
*/ */
public function findOrNew($id, $columns = ['*']) public function findOrNew($id, $columns = ['*'])
{ {

View File

@ -12,7 +12,7 @@ declare(strict_types=1);
namespace Hyperf\Database\Model\Relations; namespace Hyperf\Database\Model\Relations;
use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\Builder;
use Hyperf\Support\Str; use Hyperf\Utils\Str;
class MorphPivot extends Pivot class MorphPivot extends Pivot
{ {

View File

@ -1962,7 +1962,7 @@ class Builder
* *
* @param string $column * @param string $column
* @param string|null $key * @param string|null $key
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
public function pluck($column, $key = null) public function pluck($column, $key = null)
{ {
@ -2766,7 +2766,7 @@ class Builder
* @param array $queryResult * @param array $queryResult
* @param string $column * @param string $column
* @param string $key * @param string $key
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
protected function pluckFromObjectColumn($queryResult, $column, $key) protected function pluckFromObjectColumn($queryResult, $column, $key)
{ {
@ -2791,7 +2791,7 @@ class Builder
* @param array $queryResult * @param array $queryResult
* @param string $column * @param string $column
* @param string $key * @param string $key
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
protected function pluckFromArrayColumn($queryResult, $column, $key) protected function pluckFromArrayColumn($queryResult, $column, $key)
{ {

View File

@ -71,7 +71,7 @@ class Blueprint
/** /**
* The commands that should be run for the table. * The commands that should be run for the table.
* *
* @var \Hyperf\Support\Fluent[] * @var \Hyperf\Utils\Fluent[]
*/ */
protected $commands = []; protected $commands = [];
@ -167,7 +167,7 @@ class Blueprint
/** /**
* Indicate that the table needs to be created. * Indicate that the table needs to be created.
* *
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function create() public function create()
{ {
@ -187,7 +187,7 @@ class Blueprint
/** /**
* Indicate that the table should be dropped. * Indicate that the table should be dropped.
* *
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function drop() public function drop()
{ {
@ -197,7 +197,7 @@ class Blueprint
/** /**
* Indicate that the table should be dropped if it exists. * Indicate that the table should be dropped if it exists.
* *
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropIfExists() public function dropIfExists()
{ {
@ -208,7 +208,7 @@ class Blueprint
* Indicate that the given columns should be dropped. * Indicate that the given columns should be dropped.
* *
* @param array|mixed $columns * @param array|mixed $columns
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropColumn($columns) public function dropColumn($columns)
{ {
@ -222,7 +222,7 @@ class Blueprint
* *
* @param string $from * @param string $from
* @param string $to * @param string $to
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function renameColumn($from, $to) public function renameColumn($from, $to)
{ {
@ -233,7 +233,7 @@ class Blueprint
* Indicate that the given primary key should be dropped. * Indicate that the given primary key should be dropped.
* *
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropPrimary($index = null) public function dropPrimary($index = null)
{ {
@ -244,7 +244,7 @@ class Blueprint
* Indicate that the given unique key should be dropped. * Indicate that the given unique key should be dropped.
* *
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropUnique($index) public function dropUnique($index)
{ {
@ -255,7 +255,7 @@ class Blueprint
* Indicate that the given index should be dropped. * Indicate that the given index should be dropped.
* *
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropIndex($index) public function dropIndex($index)
{ {
@ -266,7 +266,7 @@ class Blueprint
* Indicate that the given spatial index should be dropped. * Indicate that the given spatial index should be dropped.
* *
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropSpatialIndex($index) public function dropSpatialIndex($index)
{ {
@ -277,7 +277,7 @@ class Blueprint
* Indicate that the given foreign key should be dropped. * Indicate that the given foreign key should be dropped.
* *
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function dropForeign($index) public function dropForeign($index)
{ {
@ -289,7 +289,7 @@ class Blueprint
* *
* @param string $from * @param string $from
* @param string $to * @param string $to
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function renameIndex($from, $to) public function renameIndex($from, $to)
{ {
@ -366,7 +366,7 @@ class Blueprint
* Rename the table to a given name. * Rename the table to a given name.
* *
* @param string $to * @param string $to
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function rename($to) public function rename($to)
{ {
@ -379,7 +379,7 @@ class Blueprint
* @param string|array $columns * @param string|array $columns
* @param string $name * @param string $name
* @param string|null $algorithm * @param string|null $algorithm
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function primary($columns, $name = null, $algorithm = null) public function primary($columns, $name = null, $algorithm = null)
{ {
@ -392,7 +392,7 @@ class Blueprint
* @param string|array $columns * @param string|array $columns
* @param string $name * @param string $name
* @param string|null $algorithm * @param string|null $algorithm
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function unique($columns, $name = null, $algorithm = null) public function unique($columns, $name = null, $algorithm = null)
{ {
@ -405,7 +405,7 @@ class Blueprint
* @param string|array $columns * @param string|array $columns
* @param string $name * @param string $name
* @param string|null $algorithm * @param string|null $algorithm
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function index($columns, $name = null, $algorithm = null) public function index($columns, $name = null, $algorithm = null)
{ {
@ -417,7 +417,7 @@ class Blueprint
* *
* @param string|array $columns * @param string|array $columns
* @param string $name * @param string $name
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function spatialIndex($columns, $name = null) public function spatialIndex($columns, $name = null)
{ {
@ -429,7 +429,7 @@ class Blueprint
* *
* @param string|array $columns * @param string|array $columns
* @param string $name * @param string $name
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
public function foreign($columns, $name = null) public function foreign($columns, $name = null)
{ {
@ -1174,7 +1174,7 @@ class Blueprint
/** /**
* Get the commands on the blueprint. * Get the commands on the blueprint.
* *
* @return \Hyperf\Support\Fluent[] * @return \Hyperf\Utils\Fluent[]
*/ */
public function getCommands() public function getCommands()
{ {
@ -1234,7 +1234,7 @@ class Blueprint
* Get all of the commands matching the given names. * Get all of the commands matching the given names.
* *
* @param array $names * @param array $names
* @return \Hyperf\Support\Collection * @return \Hyperf\Utils\Collection
*/ */
protected function commandsNamed(array $names) protected function commandsNamed(array $names)
{ {
@ -1313,7 +1313,7 @@ class Blueprint
* @param string|array $columns * @param string|array $columns
* @param string $index * @param string $index
* @param string|null $algorithm * @param string|null $algorithm
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
protected function indexCommand($type, $columns, $index, $algorithm = null) protected function indexCommand($type, $columns, $index, $algorithm = null)
{ {
@ -1336,7 +1336,7 @@ class Blueprint
* @param string $command * @param string $command
* @param string $type * @param string $type
* @param string|array $index * @param string|array $index
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
protected function dropIndexCommand($command, $type, $index) protected function dropIndexCommand($command, $type, $index)
{ {
@ -1371,7 +1371,7 @@ class Blueprint
* *
* @param string $name * @param string $name
* @param array $parameters * @param array $parameters
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
protected function addCommand($name, array $parameters = []) protected function addCommand($name, array $parameters = [])
{ {
@ -1385,7 +1385,7 @@ class Blueprint
* *
* @param string $name * @param string $name
* @param array $parameters * @param array $parameters
* @return \Hyperf\Support\Fluent * @return \Hyperf\Utils\Fluent
*/ */
protected function createCommand($name, array $parameters = []) protected function createCommand($name, array $parameters = [])
{ {

View File

@ -17,7 +17,7 @@ use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Hyperf\Database\Connection; use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Support\Fluent; use Hyperf\Utils\Fluent;
use RuntimeException; use RuntimeException;
class ChangeColumn class ChangeColumn
@ -27,7 +27,7 @@ class ChangeColumn
* *
* @param \Hyperf\Database\Schema\Grammars\Grammar $grammar * @param \Hyperf\Database\Schema\Grammars\Grammar $grammar
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return array * @return array
* *
@ -106,7 +106,7 @@ class ChangeColumn
* Get the Doctrine column instance for a column change. * Get the Doctrine column instance for a column change.
* *
* @param \Doctrine\DBAL\Schema\Table $table * @param \Doctrine\DBAL\Schema\Table $table
* @param \Hyperf\Support\Fluent $fluent * @param \Hyperf\Utils\Fluent $fluent
* @return \Doctrine\DBAL\Schema\Column * @return \Doctrine\DBAL\Schema\Column
*/ */
protected static function getDoctrineColumn(Table $table, Fluent $fluent) protected static function getDoctrineColumn(Table $table, Fluent $fluent)
@ -120,7 +120,7 @@ class ChangeColumn
/** /**
* Get the Doctrine column change options. * Get the Doctrine column change options.
* *
* @param \Hyperf\Support\Fluent $fluent * @param \Hyperf\Utils\Fluent $fluent
* @return array * @return array
*/ */
protected static function getDoctrineColumnChangeOptions(Fluent $fluent) protected static function getDoctrineColumnChangeOptions(Fluent $fluent)

View File

@ -39,7 +39,7 @@ abstract class Grammar extends BaseGrammar
* Compile a rename column command. * Compile a rename column command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return array * @return array
*/ */
@ -52,7 +52,7 @@ abstract class Grammar extends BaseGrammar
* Compile a change column command into a series of SQL statements. * Compile a change column command into a series of SQL statements.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return array * @return array
* *
@ -67,7 +67,7 @@ abstract class Grammar extends BaseGrammar
* Compile a foreign key command. * Compile a foreign key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileForeign(Blueprint $blueprint, Fluent $command) public function compileForeign(Blueprint $blueprint, Fluent $command)
@ -208,7 +208,7 @@ abstract class Grammar extends BaseGrammar
/** /**
* Get the SQL for the column data type. * Get the SQL for the column data type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function getType(Fluent $column) protected function getType(Fluent $column)
@ -221,7 +221,7 @@ abstract class Grammar extends BaseGrammar
* *
* @param string $sql * @param string $sql
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) protected function addModifiers($sql, Blueprint $blueprint, Fluent $column)
@ -240,7 +240,7 @@ abstract class Grammar extends BaseGrammar
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param string $name * @param string $name
* @return \Hyperf\Support\Fluent|null * @return \Hyperf\Utils\Fluent|null
*/ */
protected function getCommandByName(Blueprint $blueprint, $name) protected function getCommandByName(Blueprint $blueprint, $name)
{ {

View File

@ -58,7 +58,7 @@ class MySqlGrammar extends Grammar
* Compile a create table command. * Compile a create table command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return string * @return string
*/ */
@ -93,7 +93,7 @@ class MySqlGrammar extends Grammar
* Compile an add column command. * Compile an add column command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileAdd(Blueprint $blueprint, Fluent $command) public function compileAdd(Blueprint $blueprint, Fluent $command)
@ -107,7 +107,7 @@ class MySqlGrammar extends Grammar
* Compile a primary key command. * Compile a primary key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compilePrimary(Blueprint $blueprint, Fluent $command) public function compilePrimary(Blueprint $blueprint, Fluent $command)
@ -121,7 +121,7 @@ class MySqlGrammar extends Grammar
* Compile a unique key command. * Compile a unique key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileUnique(Blueprint $blueprint, Fluent $command) public function compileUnique(Blueprint $blueprint, Fluent $command)
@ -133,7 +133,7 @@ class MySqlGrammar extends Grammar
* Compile a plain index key command. * Compile a plain index key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileIndex(Blueprint $blueprint, Fluent $command) public function compileIndex(Blueprint $blueprint, Fluent $command)
@ -145,7 +145,7 @@ class MySqlGrammar extends Grammar
* Compile a spatial index key command. * Compile a spatial index key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) public function compileSpatialIndex(Blueprint $blueprint, Fluent $command)
@ -157,7 +157,7 @@ class MySqlGrammar extends Grammar
* Compile a drop table command. * Compile a drop table command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDrop(Blueprint $blueprint, Fluent $command) public function compileDrop(Blueprint $blueprint, Fluent $command)
@ -169,7 +169,7 @@ class MySqlGrammar extends Grammar
* Compile a drop table (if exists) command. * Compile a drop table (if exists) command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropIfExists(Blueprint $blueprint, Fluent $command) public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
@ -181,7 +181,7 @@ class MySqlGrammar extends Grammar
* Compile a drop column command. * Compile a drop column command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropColumn(Blueprint $blueprint, Fluent $command) public function compileDropColumn(Blueprint $blueprint, Fluent $command)
@ -195,7 +195,7 @@ class MySqlGrammar extends Grammar
* Compile a drop primary key command. * Compile a drop primary key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropPrimary(Blueprint $blueprint, Fluent $command) public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
@ -207,7 +207,7 @@ class MySqlGrammar extends Grammar
* Compile a drop unique key command. * Compile a drop unique key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropUnique(Blueprint $blueprint, Fluent $command) public function compileDropUnique(Blueprint $blueprint, Fluent $command)
@ -221,7 +221,7 @@ class MySqlGrammar extends Grammar
* Compile a drop index command. * Compile a drop index command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropIndex(Blueprint $blueprint, Fluent $command) public function compileDropIndex(Blueprint $blueprint, Fluent $command)
@ -235,7 +235,7 @@ class MySqlGrammar extends Grammar
* Compile a drop spatial index command. * Compile a drop spatial index command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command)
@ -247,7 +247,7 @@ class MySqlGrammar extends Grammar
* Compile a drop foreign key command. * Compile a drop foreign key command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileDropForeign(Blueprint $blueprint, Fluent $command) public function compileDropForeign(Blueprint $blueprint, Fluent $command)
@ -261,7 +261,7 @@ class MySqlGrammar extends Grammar
* Compile a rename table command. * Compile a rename table command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileRename(Blueprint $blueprint, Fluent $command) public function compileRename(Blueprint $blueprint, Fluent $command)
@ -275,7 +275,7 @@ class MySqlGrammar extends Grammar
* Compile a rename index command. * Compile a rename index command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @return string * @return string
*/ */
public function compileRenameIndex(Blueprint $blueprint, Fluent $command) public function compileRenameIndex(Blueprint $blueprint, Fluent $command)
@ -353,7 +353,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial Geometry type. * Create the column definition for a spatial Geometry type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeGeometry(Fluent $column) public function typeGeometry(Fluent $column)
@ -364,7 +364,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial Point type. * Create the column definition for a spatial Point type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typePoint(Fluent $column) public function typePoint(Fluent $column)
@ -375,7 +375,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial LineString type. * Create the column definition for a spatial LineString type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeLineString(Fluent $column) public function typeLineString(Fluent $column)
@ -386,7 +386,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial Polygon type. * Create the column definition for a spatial Polygon type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typePolygon(Fluent $column) public function typePolygon(Fluent $column)
@ -397,7 +397,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial GeometryCollection type. * Create the column definition for a spatial GeometryCollection type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeGeometryCollection(Fluent $column) public function typeGeometryCollection(Fluent $column)
@ -408,7 +408,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial MultiPoint type. * Create the column definition for a spatial MultiPoint type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeMultiPoint(Fluent $column) public function typeMultiPoint(Fluent $column)
@ -419,7 +419,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial MultiLineString type. * Create the column definition for a spatial MultiLineString type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeMultiLineString(Fluent $column) public function typeMultiLineString(Fluent $column)
@ -430,7 +430,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a spatial MultiPolygon type. * Create the column definition for a spatial MultiPolygon type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
public function typeMultiPolygon(Fluent $column) public function typeMultiPolygon(Fluent $column)
@ -442,7 +442,7 @@ class MySqlGrammar extends Grammar
* Create the main create table clause. * Create the main create table clause.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return string * @return string
*/ */
@ -510,7 +510,7 @@ class MySqlGrammar extends Grammar
* Compile an index creation command. * Compile an index creation command.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param string $type * @param string $type
* @return string * @return string
*/ */
@ -529,7 +529,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a char type. * Create the column definition for a char type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeChar(Fluent $column) protected function typeChar(Fluent $column)
@ -540,7 +540,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a string type. * Create the column definition for a string type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeString(Fluent $column) protected function typeString(Fluent $column)
@ -551,7 +551,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a text type. * Create the column definition for a text type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeText(Fluent $column) protected function typeText(Fluent $column)
@ -562,7 +562,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a medium text type. * Create the column definition for a medium text type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeMediumText(Fluent $column) protected function typeMediumText(Fluent $column)
@ -573,7 +573,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a long text type. * Create the column definition for a long text type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeLongText(Fluent $column) protected function typeLongText(Fluent $column)
@ -584,7 +584,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a big integer type. * Create the column definition for a big integer type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeBigInteger(Fluent $column) protected function typeBigInteger(Fluent $column)
@ -595,7 +595,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for an integer type. * Create the column definition for an integer type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeInteger(Fluent $column) protected function typeInteger(Fluent $column)
@ -606,7 +606,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a medium integer type. * Create the column definition for a medium integer type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeMediumInteger(Fluent $column) protected function typeMediumInteger(Fluent $column)
@ -617,7 +617,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a tiny integer type. * Create the column definition for a tiny integer type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeTinyInteger(Fluent $column) protected function typeTinyInteger(Fluent $column)
@ -628,7 +628,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a small integer type. * Create the column definition for a small integer type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeSmallInteger(Fluent $column) protected function typeSmallInteger(Fluent $column)
@ -639,7 +639,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a float type. * Create the column definition for a float type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeFloat(Fluent $column) protected function typeFloat(Fluent $column)
@ -650,7 +650,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a double type. * Create the column definition for a double type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeDouble(Fluent $column) protected function typeDouble(Fluent $column)
@ -665,7 +665,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a decimal type. * Create the column definition for a decimal type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeDecimal(Fluent $column) protected function typeDecimal(Fluent $column)
@ -676,7 +676,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a boolean type. * Create the column definition for a boolean type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeBoolean(Fluent $column) protected function typeBoolean(Fluent $column)
@ -687,7 +687,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for an enumeration type. * Create the column definition for an enumeration type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeEnum(Fluent $column) protected function typeEnum(Fluent $column)
@ -698,7 +698,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a json type. * Create the column definition for a json type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeJson(Fluent $column) protected function typeJson(Fluent $column)
@ -709,7 +709,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a jsonb type. * Create the column definition for a jsonb type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeJsonb(Fluent $column) protected function typeJsonb(Fluent $column)
@ -720,7 +720,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a date type. * Create the column definition for a date type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeDate(Fluent $column) protected function typeDate(Fluent $column)
@ -731,7 +731,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a date-time type. * Create the column definition for a date-time type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeDateTime(Fluent $column) protected function typeDateTime(Fluent $column)
@ -744,7 +744,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a date-time (with time zone) type. * Create the column definition for a date-time (with time zone) type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeDateTimeTz(Fluent $column) protected function typeDateTimeTz(Fluent $column)
@ -755,7 +755,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a time type. * Create the column definition for a time type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeTime(Fluent $column) protected function typeTime(Fluent $column)
@ -766,7 +766,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a time (with time zone) type. * Create the column definition for a time (with time zone) type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeTimeTz(Fluent $column) protected function typeTimeTz(Fluent $column)
@ -777,7 +777,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a timestamp type. * Create the column definition for a timestamp type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeTimestamp(Fluent $column) protected function typeTimestamp(Fluent $column)
@ -790,7 +790,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a timestamp (with time zone) type. * Create the column definition for a timestamp (with time zone) type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeTimestampTz(Fluent $column) protected function typeTimestampTz(Fluent $column)
@ -801,7 +801,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a year type. * Create the column definition for a year type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeYear(Fluent $column) protected function typeYear(Fluent $column)
@ -812,7 +812,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a binary type. * Create the column definition for a binary type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeBinary(Fluent $column) protected function typeBinary(Fluent $column)
@ -823,7 +823,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a uuid type. * Create the column definition for a uuid type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeUuid(Fluent $column) protected function typeUuid(Fluent $column)
@ -834,7 +834,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for an IP address type. * Create the column definition for an IP address type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeIpAddress(Fluent $column) protected function typeIpAddress(Fluent $column)
@ -845,7 +845,7 @@ class MySqlGrammar extends Grammar
/** /**
* Create the column definition for a MAC address type. * Create the column definition for a MAC address type.
* *
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string * @return string
*/ */
protected function typeMacAddress(Fluent $column) protected function typeMacAddress(Fluent $column)
@ -857,7 +857,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a generated virtual column modifier. * Get the SQL for a generated virtual column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column)
@ -871,7 +871,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a generated stored column modifier. * Get the SQL for a generated stored column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) protected function modifyStoredAs(Blueprint $blueprint, Fluent $column)
@ -885,7 +885,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for an unsigned column modifier. * Get the SQL for an unsigned column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) protected function modifyUnsigned(Blueprint $blueprint, Fluent $column)
@ -899,7 +899,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a character set column modifier. * Get the SQL for a character set column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyCharset(Blueprint $blueprint, Fluent $column) protected function modifyCharset(Blueprint $blueprint, Fluent $column)
@ -913,7 +913,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a collation column modifier. * Get the SQL for a collation column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyCollate(Blueprint $blueprint, Fluent $column) protected function modifyCollate(Blueprint $blueprint, Fluent $column)
@ -927,7 +927,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a nullable column modifier. * Get the SQL for a nullable column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyNullable(Blueprint $blueprint, Fluent $column) protected function modifyNullable(Blueprint $blueprint, Fluent $column)
@ -941,7 +941,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a default column modifier. * Get the SQL for a default column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyDefault(Blueprint $blueprint, Fluent $column) protected function modifyDefault(Blueprint $blueprint, Fluent $column)
@ -955,7 +955,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for an auto-increment column modifier. * Get the SQL for an auto-increment column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyIncrement(Blueprint $blueprint, Fluent $column) protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
@ -969,7 +969,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a "first" column modifier. * Get the SQL for a "first" column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyFirst(Blueprint $blueprint, Fluent $column) protected function modifyFirst(Blueprint $blueprint, Fluent $column)
@ -983,7 +983,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for an "after" column modifier. * Get the SQL for an "after" column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyAfter(Blueprint $blueprint, Fluent $column) protected function modifyAfter(Blueprint $blueprint, Fluent $column)
@ -997,7 +997,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a "comment" column modifier. * Get the SQL for a "comment" column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifyComment(Blueprint $blueprint, Fluent $column) protected function modifyComment(Blueprint $blueprint, Fluent $column)
@ -1011,7 +1011,7 @@ class MySqlGrammar extends Grammar
* Get the SQL for a SRID column modifier. * Get the SQL for a SRID column modifier.
* *
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $column * @param \Hyperf\Utils\Fluent $column
* @return string|null * @return string|null
*/ */
protected function modifySrid(Blueprint $blueprint, Fluent $column) protected function modifySrid(Blueprint $blueprint, Fluent $column)

View File

@ -16,7 +16,7 @@ use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use Hyperf\Database\Connection; use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Support\Fluent; use Hyperf\Utils\Fluent;
class RenameColumn class RenameColumn
{ {
@ -25,7 +25,7 @@ class RenameColumn
* *
* @param \Hyperf\Database\Schema\Grammars\Grammar $grammar * @param \Hyperf\Database\Schema\Grammars\Grammar $grammar
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Hyperf\Database\Connection $connection * @param \Hyperf\Database\Connection $connection
* @return array * @return array
*/ */
@ -52,7 +52,7 @@ class RenameColumn
* *
* @param \Hyperf\Database\Schema\Grammars\Grammar $grammar * @param \Hyperf\Database\Schema\Grammars\Grammar $grammar
* @param \Hyperf\Database\Schema\Blueprint $blueprint * @param \Hyperf\Database\Schema\Blueprint $blueprint
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Doctrine\DBAL\Schema\Column $column * @param \Doctrine\DBAL\Schema\Column $column
* @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
* @return \Doctrine\DBAL\Schema\TableDiff * @return \Doctrine\DBAL\Schema\TableDiff
@ -70,7 +70,7 @@ class RenameColumn
* Set the renamed columns on the table diff. * Set the renamed columns on the table diff.
* *
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
* @param \Hyperf\Support\Fluent $command * @param \Hyperf\Utils\Fluent $command
* @param \Doctrine\DBAL\Schema\Column $column * @param \Doctrine\DBAL\Schema\Column $column
* @return \Doctrine\DBAL\Schema\TableDiff * @return \Doctrine\DBAL\Schema\TableDiff
*/ */

View File

@ -9,6 +9,7 @@ use Hyperf\Database\ConnectionResolverInterface;
use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection; use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Model; use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Register;
use Hyperf\Database\Model\SoftDeletes; use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Database\Query\Builder as BaseBuilder; use Hyperf\Database\Query\Builder as BaseBuilder;
use Hyperf\Database\Query\Grammars\Grammar; use Hyperf\Database\Query\Grammars\Grammar;
@ -211,6 +212,8 @@ class ModelBuilderTest extends TestCase
$builder->chunk(2, function ($results) use ($callbackAssertor) { $builder->chunk(2, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}); });
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkWithLastChunkPartial() public function testChunkWithLastChunkPartial()
@ -231,6 +234,8 @@ class ModelBuilderTest extends TestCase
$builder->chunk(2, function ($results) use ($callbackAssertor) { $builder->chunk(2, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}); });
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkCanBeStoppedByReturningFalse() public function testChunkCanBeStoppedByReturningFalse()
@ -253,6 +258,8 @@ class ModelBuilderTest extends TestCase
return false; return false;
}); });
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkWithCountZero() public function testChunkWithCountZero()
@ -270,6 +277,8 @@ class ModelBuilderTest extends TestCase
$builder->chunk(0, function ($results) use ($callbackAssertor) { $builder->chunk(0, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}); });
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkPaginatesUsingIdWithLastChunkComplete() public function testChunkPaginatesUsingIdWithLastChunkComplete()
@ -293,6 +302,8 @@ class ModelBuilderTest extends TestCase
$builder->chunkById(2, function ($results) use ($callbackAssertor) { $builder->chunkById(2, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}, 'someIdField'); }, 'someIdField');
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkPaginatesUsingIdWithLastChunkPartial() public function testChunkPaginatesUsingIdWithLastChunkPartial()
@ -313,6 +324,9 @@ class ModelBuilderTest extends TestCase
$builder->chunkById(2, function ($results) use ($callbackAssertor) { $builder->chunkById(2, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}, 'someIdField'); }, 'someIdField');
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testChunkPaginatesUsingIdWithCountZero() public function testChunkPaginatesUsingIdWithCountZero()
@ -330,6 +344,9 @@ class ModelBuilderTest extends TestCase
$builder->chunkById(0, function ($results) use ($callbackAssertor) { $builder->chunkById(0, function ($results) use ($callbackAssertor) {
$callbackAssertor->doSomething($results); $callbackAssertor->doSomething($results);
}, 'someIdField'); }, 'someIdField');
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testPluckReturnsTheMutatedAttributesOfAModel() public function testPluckReturnsTheMutatedAttributesOfAModel()
@ -487,6 +504,9 @@ class ModelBuilderTest extends TestCase
$builder->setEagerLoads(['orders' => null, 'orders.lines' => null, 'orders.lines.details' => null]); $builder->setEagerLoads(['orders' => null, 'orders.lines' => null, 'orders.lines.details' => null]);
$builder->getRelation('orders'); $builder->getRelation('orders');
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
public function testGetRelationProperlySetsNestedRelationshipsWithSimilarNames() public function testGetRelationProperlySetsNestedRelationshipsWithSimilarNames()
@ -507,6 +527,9 @@ class ModelBuilderTest extends TestCase
$builder->getRelation('orders'); $builder->getRelation('orders');
$builder->getRelation('ordersGroups'); $builder->getRelation('ordersGroups');
// Avoid 'This test did not perform any assertions' notice
$this->assertTrue(true);
} }
/** /**
@ -611,7 +634,7 @@ class ModelBuilderTest extends TestCase
public function testRealNestedWhereWithScopes() public function testRealNestedWhereWithScopes()
{ {
$model = new ModelBuilderTestNestedStub; $model = new ModelBuilderTestNestedStub;
$this->mockConnectionForModel($model, 'SQLite'); $this->mockConnectionForModel($model, 'MySQL');
$query = $model->newQuery()->where('foo', '=', 'bar')->where(function ($query) { $query = $model->newQuery()->where('foo', '=', 'bar')->where(function ($query) {
$query->where('baz', '>', 9000); $query->where('baz', '>', 9000);
}); });
@ -622,7 +645,7 @@ class ModelBuilderTest extends TestCase
public function testRealNestedWhereWithMultipleScopesAndOneDeadScope() public function testRealNestedWhereWithMultipleScopesAndOneDeadScope()
{ {
$model = new ModelBuilderTestNestedStub; $model = new ModelBuilderTestNestedStub;
$this->mockConnectionForModel($model, 'SQLite'); $this->mockConnectionForModel($model, 'MySQL');
$query = $model->newQuery()->empty()->where('foo', '=', 'bar')->empty()->where(function ($query) { $query = $model->newQuery()->empty()->where('foo', '=', 'bar')->empty()->where(function ($query) {
$query->empty()->where('baz', '>', 9000); $query->empty()->where('baz', '>', 9000);
}); });
@ -661,7 +684,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->withCount('foo'); $builder = $model->withCount('foo');
$this->assertEquals('select "eloquent_builder_test_model_parent_stubs".*, (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testWithCountAndSelect() public function testWithCountAndSelect()
@ -670,7 +693,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->select('id')->withCount('foo'); $builder = $model->select('id')->withCount('foo');
$this->assertEquals('select "id", (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "id", (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testWithCountAndMergedWheres() public function testWithCountAndMergedWheres()
@ -681,7 +704,7 @@ class ModelBuilderTest extends TestCase
$q->where('bam', '>', 'qux'); $q->where('bam', '>', 'qux');
}]); }]);
$this->assertEquals('select "id", (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and "bam" > ? and "active" = ?) as "active_foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "id", (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and "bam" > ? and "active" = ?) as "active_foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
$this->assertEquals(['qux', true], $builder->getBindings()); $this->assertEquals(['qux', true], $builder->getBindings());
} }
@ -699,7 +722,7 @@ class ModelBuilderTest extends TestCase
// //
}); });
$this->assertEquals('select "id", (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "id", (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testWithCountAndConstraintsAndHaving() public function testWithCountAndConstraintsAndHaving()
@ -711,7 +734,7 @@ class ModelBuilderTest extends TestCase
$q->where('bam', '>', 'qux'); $q->where('bam', '>', 'qux');
}])->having('foo_count', '>=', 1); }])->having('foo_count', '>=', 1);
$this->assertEquals('select "eloquent_builder_test_model_parent_stubs".*, (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and "bam" > ?) as "foo_count" from "eloquent_builder_test_model_parent_stubs" where "bar" = ? having "foo_count" >= ?', $builder->toSql()); $this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and "bam" > ?) as "foo_count" from "model_builder_test_model_parent_stubs" where "bar" = ? having "foo_count" >= ?', $builder->toSql());
$this->assertEquals(['qux', 'baz', 1], $builder->getBindings()); $this->assertEquals(['qux', 'baz', 1], $builder->getBindings());
} }
@ -721,7 +744,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->withCount('foo as foo_bar'); $builder = $model->withCount('foo as foo_bar');
$this->assertEquals('select "eloquent_builder_test_model_parent_stubs".*, (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_bar" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_bar" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testWithCountMultipleAndPartialRename() public function testWithCountMultipleAndPartialRename()
@ -730,7 +753,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->withCount(['foo as foo_bar', 'foo']); $builder = $model->withCount(['foo as foo_bar', 'foo']);
$this->assertEquals('select "eloquent_builder_test_model_parent_stubs".*, (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_bar", (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql()); $this->assertEquals('select "model_builder_test_model_parent_stubs".*, (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_bar", (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id") as "foo_count" from "model_builder_test_model_parent_stubs"', $builder->toSql());
} }
public function testHasWithConstraintsAndHavingInSubquery() public function testHasWithConstraintsAndHavingInSubquery()
@ -742,7 +765,7 @@ class ModelBuilderTest extends TestCase
$q->having('bam', '>', 'qux'); $q->having('bam', '>', 'qux');
})->where('quux', 'quuux'); })->where('quux', 'quuux');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? and exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" having "bam" > ?) and "quux" = ?', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "bar" = ? and exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" having "bam" > ?) and "quux" = ?', $builder->toSql());
$this->assertEquals(['baz', 'qux', 'quuux'], $builder->getBindings()); $this->assertEquals(['baz', 'qux', 'quuux'], $builder->getBindings());
} }
@ -757,7 +780,7 @@ class ModelBuilderTest extends TestCase
$q->having('street', '=', 'fooside dr'); $q->having('street', '=', 'fooside dr');
})->where('age', 29); })->where('age', 29);
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "name" = ? and exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and ("zipcode" = ? or "zipcode" = ?) having "street" = ?) and "age" = ?', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "name" = ? and exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and ("zipcode" = ? or "zipcode" = ?) having "street" = ?) and "age" = ?', $builder->toSql());
$this->assertEquals(['larry', '90210', '90220', 'fooside dr', 29], $builder->getBindings()); $this->assertEquals(['larry', '90210', '90220', 'fooside dr', 29], $builder->getBindings());
} }
@ -772,7 +795,7 @@ class ModelBuilderTest extends TestCase
$q->having('bam', '>', 'qux'); $q->having('bam', '>', 'qux');
})->where('quux', 'quuux'); })->where('quux', 'quuux');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? and exists (select * from "eloquent_builder_test_model_close_related_stubs" inner join "quuuux" on "quuuuux" = ? where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" having "bam" > ?) and "quux" = ?', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "bar" = ? and exists (select * from "model_builder_test_model_close_related_stubs" inner join "quuuux" on "quuuuux" = ? where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" having "bam" > ?) and "quux" = ?', $builder->toSql());
$this->assertEquals(['baz', 'quuuuuux', 'qux', 'quuux'], $builder->getBindings()); $this->assertEquals(['baz', 'quuuuuux', 'qux', 'quuux'], $builder->getBindings());
} }
@ -785,7 +808,7 @@ class ModelBuilderTest extends TestCase
$q->having('bam', '>', 'qux'); $q->having('bam', '>', 'qux');
}, '>=', 2)->where('quux', 'quuux'); }, '>=', 2)->where('quux', 'quuux');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? and (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" having "bam" > ?) >= 2 and "quux" = ?', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "bar" = ? and (select count(*) from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" having "bam" > ?) >= 2 and "quux" = ?', $builder->toSql());
$this->assertEquals(['baz', 'qux', 'quuux'], $builder->getBindings()); $this->assertEquals(['baz', 'qux', 'quuux'], $builder->getBindings());
} }
@ -875,7 +898,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->doesntHave('foo'); $builder = $model->doesntHave('foo');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where not exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id")', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where not exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id")', $builder->toSql());
} }
public function testDoesntHaveNested() public function testDoesntHaveNested()
@ -884,7 +907,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->doesntHave('foo.bar'); $builder = $model->doesntHave('foo.bar');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where not exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and exists (select * from "eloquent_builder_test_model_far_related_stubs" where "eloquent_builder_test_model_close_related_stubs"."id" = "eloquent_builder_test_model_far_related_stubs"."eloquent_builder_test_model_close_related_stub_id"))', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where not exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and exists (select * from "model_builder_test_model_far_related_stubs" where "model_builder_test_model_close_related_stubs"."id" = "model_builder_test_model_far_related_stubs"."model_builder_test_model_close_related_stub_id"))', $builder->toSql());
} }
public function testOrDoesntHave() public function testOrDoesntHave()
@ -893,7 +916,7 @@ class ModelBuilderTest extends TestCase
$builder = $model->where('bar', 'baz')->orDoesntHave('foo'); $builder = $model->where('bar', 'baz')->orDoesntHave('foo');
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? or not exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id")', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "bar" = ? or not exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id")', $builder->toSql());
$this->assertEquals(['baz'], $builder->getBindings()); $this->assertEquals(['baz'], $builder->getBindings());
} }
@ -905,7 +928,7 @@ class ModelBuilderTest extends TestCase
$query->where('bar', 'baz'); $query->where('bar', 'baz');
}); });
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where not exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and "bar" = ?)', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where not exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and "bar" = ?)', $builder->toSql());
$this->assertEquals(['baz'], $builder->getBindings()); $this->assertEquals(['baz'], $builder->getBindings());
} }
@ -917,7 +940,7 @@ class ModelBuilderTest extends TestCase
$query->where('qux', 'quux'); $query->where('qux', 'quux');
}); });
$this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? or not exists (select * from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" and "qux" = ?)', $builder->toSql()); $this->assertEquals('select * from "model_builder_test_model_parent_stubs" where "bar" = ? or not exists (select * from "model_builder_test_model_close_related_stubs" where "model_builder_test_model_parent_stubs"."foo_id" = "model_builder_test_model_close_related_stubs"."id" and "qux" = ?)', $builder->toSql());
$this->assertEquals(['baz', 'quux'], $builder->getBindings()); $this->assertEquals(['baz', 'quux'], $builder->getBindings());
} }
@ -1126,8 +1149,8 @@ class ModelBuilderTest extends TestCase
$processor = new $processorClass; $processor = new $processorClass;
$connection = Mockery::mock(ConnectionInterface::class, ['getQueryGrammar' => $grammar, 'getPostProcessor' => $processor]); $connection = Mockery::mock(ConnectionInterface::class, ['getQueryGrammar' => $grammar, 'getPostProcessor' => $processor]);
$resolver = Mockery::mock(ConnectionResolverInterface::class, ['connection' => $connection]); $resolver = Mockery::mock(ConnectionResolverInterface::class, ['connection' => $connection]);
$class = get_class($model); // @TODO How to register different connection to different model ?
$class::setConnectionResolver($resolver); Register::setConnectionResolver($resolver);
} }
protected function getBuilder() protected function getBuilder()