Grammar/Vocabulary fixes
Signed-off-by: Chris Berthe <chrisberthe@gmail.com>
This commit is contained in:
@@ -209,7 +209,7 @@ class Connection {
|
||||
/**
|
||||
* Execute a SQL query against the connection.
|
||||
*
|
||||
* The PDO statement and boolean result will be return in an array.
|
||||
* The PDO statement and boolean result will be returned in an array.
|
||||
*
|
||||
* @param string $sql
|
||||
* @param array $bindings
|
||||
@@ -265,7 +265,7 @@ class Connection {
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
// Once we have execute the query, we log the SQL, bindings, and
|
||||
// Once we have executed the query, we log the SQL, bindings, and
|
||||
// execution time in a static array that is accessed by all of
|
||||
// the connections actively being used by the application.
|
||||
if (Config::get('database.profile'))
|
||||
@@ -287,7 +287,7 @@ class Connection {
|
||||
{
|
||||
// If the fetch style is "class", we'll hydrate an array of PHP
|
||||
// stdClass objects as generic containers for the query rows,
|
||||
// otherwise we'll just use the fetch styel value.
|
||||
// otherwise we'll just use the fetch style value.
|
||||
if ($style === PDO::FETCH_CLASS)
|
||||
{
|
||||
return $statement->fetchAll(PDO::FETCH_CLASS, 'stdClass');
|
||||
|
||||
@@ -736,7 +736,7 @@ abstract class Model {
|
||||
{
|
||||
$meta = array('key', 'table', 'connection', 'sequence', 'per_page', 'timestamps');
|
||||
|
||||
// If the method is actually the name of a static property on the model we'll
|
||||
// If the method is actually the name of a static property on the model, we'll
|
||||
// return the value of the static property. This makes it convenient for
|
||||
// relationships to access these values off of the instances.
|
||||
if (in_array($method, $meta))
|
||||
@@ -746,7 +746,7 @@ abstract class Model {
|
||||
|
||||
$underscored = array('with', 'find');
|
||||
|
||||
// Some methods need to be accessed both staticly and non-staticly so we'll
|
||||
// Some methods need to be accessed both statically and non-statically so we'll
|
||||
// keep underscored methods of those methods and intercept calls to them
|
||||
// here so they can be called either way on the model instance.
|
||||
if (in_array($method, $underscored))
|
||||
|
||||
@@ -118,7 +118,7 @@ class Query {
|
||||
$new = new $class(array(), true);
|
||||
|
||||
// We need to set the attributes manually in case the accessible property is
|
||||
// set on the array which will prevent the mass assignemnt of attributes if
|
||||
// set on the array which will prevent the mass assignment of attributes if
|
||||
// we were to pass them in using the constructor or fill methods.
|
||||
$new->fill_raw($result);
|
||||
|
||||
@@ -141,7 +141,7 @@ class Query {
|
||||
}
|
||||
}
|
||||
|
||||
// The many to many relationships may have pivot table column on them
|
||||
// The many to many relationships may have pivot table columns on them
|
||||
// so we will call the "clean" method on the relationship to remove
|
||||
// any pivot columns that are on the model.
|
||||
if ($this instanceof Relationships\Has_Many_And_Belongs_To)
|
||||
@@ -199,7 +199,7 @@ class Query {
|
||||
foreach ($this->model_includes() as $include => $constraints)
|
||||
{
|
||||
// To get the nested includes, we want to find any includes that begin
|
||||
// the relationship and a dot, then we will strip off the leading
|
||||
// the relationship with a dot, then we will strip off the leading
|
||||
// nesting indicator and set the include in the array.
|
||||
if (starts_with($include, $relationship.'.'))
|
||||
{
|
||||
@@ -222,7 +222,7 @@ class Query {
|
||||
foreach ($this->model->includes as $relationship => $constraints)
|
||||
{
|
||||
// When eager loading relationships, constraints may be set on the eager
|
||||
// load definition; however, is none are set, we need to swap the key
|
||||
// load definition; however, if none are set, we need to swap the key
|
||||
// and the value of the array since there are no constraints.
|
||||
if (is_numeric($relationship))
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ class Has_Many_And_Belongs_To extends Relationship {
|
||||
$this->joining = $table ?: $this->joining($model, $associated);
|
||||
|
||||
// If the Pivot table is timestamped, we'll set the timestamp columns to be
|
||||
// fetched when the pivot table models are fetched by the developer else
|
||||
// fetched when the pivot table models are fetched by the developer, or else
|
||||
// the ID will be the only "extra" column fetched in by default.
|
||||
if (Pivot::$timestamps)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ class Has_Many_And_Belongs_To extends Relationship {
|
||||
}
|
||||
|
||||
// Next we will take the difference of the current and given IDs and detach
|
||||
// all of the entities that exists in the current array but are not in
|
||||
// all of the entities that exist in the current array but are not in
|
||||
// the array of IDs given to the method, finishing the sync.
|
||||
$detach = array_diff($current, $ids);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class Grammar {
|
||||
*/
|
||||
public function wrap_table($table)
|
||||
{
|
||||
// Expressions should be injected into the query as raw strings so
|
||||
// Expressions should be injected into the query as raw strings
|
||||
// so we do not want to wrap them in any way. We will just return
|
||||
// the string value from the expression to be included.
|
||||
if ($table instanceof Expression)
|
||||
@@ -64,7 +64,7 @@ abstract class Grammar {
|
||||
*/
|
||||
public function wrap($value)
|
||||
{
|
||||
// Expressions should be injected into the query as raw strings so
|
||||
// Expressions should be injected into the query as raw strings
|
||||
// so we do not want to wrap them in any way. We will just return
|
||||
// the string value from the expression to be included.
|
||||
if ($value instanceof Expression)
|
||||
|
||||
@@ -158,7 +158,7 @@ class Query {
|
||||
{
|
||||
// If the "column" is really an instance of a Closure, the developer is
|
||||
// trying to create a join with a complex "ON" clause. So, we will add
|
||||
// the join, and then call the Closure with the join/
|
||||
// the join, and then call the Closure with the join.
|
||||
if ($column1 instanceof Closure)
|
||||
{
|
||||
$this->joins[] = new Query\Join($type, $table);
|
||||
@@ -167,8 +167,8 @@ class Query {
|
||||
}
|
||||
|
||||
// If the column is just a string, we can assume that the join just
|
||||
// has a simple on clause, and we'll create the join instance and
|
||||
// add the clause automatically for the develoepr.
|
||||
// has a simple "ON" clause, and we'll create the join instance and
|
||||
// add the clause automatically for the developer.
|
||||
else
|
||||
{
|
||||
$join = new Query\Join($type, $table);
|
||||
@@ -453,7 +453,7 @@ class Query {
|
||||
|
||||
foreach ($segments as $segment)
|
||||
{
|
||||
// If the segment is not a boolean connector, we can assume it it is
|
||||
// If the segment is not a boolean connector, we can assume it is
|
||||
// a column name, and we'll add it to the query as a new constraint
|
||||
// of the query's where clause and keep iterating the segments.
|
||||
if ($segment != '_and_' and $segment != '_or_')
|
||||
@@ -676,7 +676,7 @@ class Query {
|
||||
public function aggregate($aggregator, $columns)
|
||||
{
|
||||
// We'll set the aggregate value so the grammar does not try to compile
|
||||
// a SELECT clause on the query. If an aggregator is present, it's own
|
||||
// a SELECT clause on the query. If an aggregator is present, its own
|
||||
// grammar function will be used to build the SQL syntax.
|
||||
$this->aggregate = compact('aggregator', 'columns');
|
||||
|
||||
@@ -730,12 +730,12 @@ class Query {
|
||||
{
|
||||
// Force every insert to be treated like a batch insert to make creating
|
||||
// the binding array simpler since we can just spin through the inserted
|
||||
// rows as if there/ was more than one every time.
|
||||
// rows as if there was more than one every time.
|
||||
if ( ! is_array(reset($values))) $values = array($values);
|
||||
|
||||
$bindings = array();
|
||||
|
||||
// We need to merge the the insert values into the array of the query
|
||||
// We need to merge the insert values into the array of the query
|
||||
// bindings so that they will be bound to the PDO statement when it
|
||||
// is executed by the database connection.
|
||||
foreach ($values as $value)
|
||||
@@ -836,7 +836,7 @@ class Query {
|
||||
/**
|
||||
* Execute the query as a DELETE statement.
|
||||
*
|
||||
* Optionally, an ID may be passed to the method do delete a specific row.
|
||||
* Optionally, an ID may be passed to the method to delete a specific row.
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
|
||||
@@ -13,7 +13,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
public $datetime = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* All of the query componenets in the order they should be built.
|
||||
* All of the query components in the order they should be built.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
protected function joins(Query $query)
|
||||
{
|
||||
// We need to iterate through each JOIN clause that is attached to the
|
||||
// query an translate it into SQL. The table and the columns will be
|
||||
// query and translate it into SQL. The table and the columns will be
|
||||
// wrapped in identifiers to avoid naming collisions.
|
||||
foreach ($query->joins as $join)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
|
||||
// Each JOIN statement may have multiple clauses, so we will iterate
|
||||
// through each clause creating the conditions then we'll join all
|
||||
// of the together at the end to build the clause.
|
||||
// of them together at the end to build the clause.
|
||||
foreach ($join->clauses as $clause)
|
||||
{
|
||||
extract($clause);
|
||||
@@ -149,7 +149,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
|
||||
// The first clause will have a connector on the front, but it is
|
||||
// not needed on the first condition, so we will strip it off of
|
||||
// the condition before adding it to the arrya of joins.
|
||||
// the condition before adding it to the array of joins.
|
||||
$search = array('AND ', 'OR ');
|
||||
|
||||
$clauses[0] = str_replace($search, '', $clauses[0]);
|
||||
@@ -376,7 +376,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a SQL INSERT and get ID statment from a Query instance.
|
||||
* Compile a SQL INSERT and get ID statement from a Query instance.
|
||||
*
|
||||
* @param Query $query
|
||||
* @param array $values
|
||||
@@ -389,7 +389,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a SQL UPDATE statment from a Query instance.
|
||||
* Compile a SQL UPDATE statement from a Query instance.
|
||||
*
|
||||
* @param Query $query
|
||||
* @param array $values
|
||||
@@ -416,7 +416,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a SQL DELETE statment from a Query instance.
|
||||
* Compile a SQL DELETE statement from a Query instance.
|
||||
*
|
||||
* @param Query $query
|
||||
* @return string
|
||||
|
||||
@@ -5,7 +5,7 @@ use Laravel\Database\Query;
|
||||
class Postgres extends Grammar {
|
||||
|
||||
/**
|
||||
* Compile a SQL INSERT and get ID statment from a Query instance.
|
||||
* Compile a SQL INSERT and get ID statement from a Query instance.
|
||||
*
|
||||
* @param Query $query
|
||||
* @param array $values
|
||||
|
||||
@@ -95,7 +95,7 @@ class SQLServer extends Grammar {
|
||||
|
||||
// Next we need to calculate the constraint that should be placed on
|
||||
// the row number to get the correct offset and limit on the query.
|
||||
// If there is not limit, we'll just handle the offset.
|
||||
// If there is not a limit, we'll just handle the offset.
|
||||
if ($query->limit > 0)
|
||||
{
|
||||
$finish = $query->offset + $query->limit;
|
||||
|
||||
@@ -71,7 +71,7 @@ class Schema {
|
||||
{
|
||||
// The implications method is responsible for finding any fluently
|
||||
// defined indexes on the schema table and adding the explicit
|
||||
// commands that are needed to tbe schema instance.
|
||||
// commands that are needed for the schema instance.
|
||||
static::implications($table);
|
||||
|
||||
foreach ($table->commands as $command)
|
||||
|
||||
@@ -37,7 +37,7 @@ class MySQL extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Geenrate the SQL statements for a table modification command.
|
||||
* Generate the SQL statements for a table modification command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -47,7 +47,7 @@ class MySQL extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// Once we have the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
@@ -260,7 +260,7 @@ class MySQL extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqique key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -284,7 +284,7 @@ class MySQL extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqique key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -353,7 +353,7 @@ class MySQL extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the data-type definintion for a decimal.
|
||||
* Generate the data-type definition for a decimal.
|
||||
*
|
||||
* @param Fluent $column
|
||||
* @return string
|
||||
|
||||
@@ -35,7 +35,7 @@ class Postgres extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// Once we have the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
@@ -246,7 +246,7 @@ class Postgres extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqique key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
|
||||
@@ -29,7 +29,7 @@ class SQLite extends Grammar {
|
||||
return $value->type == 'primary';
|
||||
});
|
||||
|
||||
// If we found primary key in the array of commands, we'll create the SQL for
|
||||
// If we found primary keys in the array of commands, we'll create the SQL for
|
||||
// the key addition and append it to the SQL table creation statement for
|
||||
// the schema table so the index is properly generated.
|
||||
if ( ! is_null($primary))
|
||||
@@ -43,7 +43,7 @@ class SQLite extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Geenrate the SQL statements for a table modification command.
|
||||
* Generate the SQL statements for a table modification command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -53,7 +53,7 @@ class SQLite extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// Once we have the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = array_map(function($column)
|
||||
@@ -87,7 +87,7 @@ class SQLite extends Grammar {
|
||||
{
|
||||
// Each of the data type's have their own definition creation method
|
||||
// which is responsible for creating the SQL for the type. This lets
|
||||
// us to keep the syntax easy and fluent, while translating the
|
||||
// us keep the syntax easy and fluent, while translating the
|
||||
// types to the types used by the database.
|
||||
$sql = $this->wrap($column).' '.$this->type($column);
|
||||
|
||||
@@ -214,7 +214,7 @@ class SQLite extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqique key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -226,7 +226,7 @@ class SQLite extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqique key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
|
||||
@@ -32,7 +32,7 @@ class SQLServer extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Geenrate the SQL statements for a table modification command.
|
||||
* Generate the SQL statements for a table modification command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
@@ -42,7 +42,7 @@ class SQLServer extends Grammar {
|
||||
{
|
||||
$columns = $this->columns($table);
|
||||
|
||||
// Once we the array of column definitions, we need to add "add" to the
|
||||
// Once we have the array of column definitions, we need to add "add" to the
|
||||
// front of each definition, then we'll concatenate the definitions
|
||||
// using commas like normal and generate the SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
@@ -235,7 +235,7 @@ class SQLServer extends Grammar {
|
||||
{
|
||||
$columns = array_map(array($this, 'wrap'), $command->columns);
|
||||
|
||||
// Once we the array of column names, we need to add "drop" to the front
|
||||
// Once we have the array of column names, we need to add "drop" to the front
|
||||
// of each column, then we'll concatenate the columns using commas and
|
||||
// generate the alter statement SQL.
|
||||
$columns = implode(', ', array_map(function($column)
|
||||
@@ -260,7 +260,7 @@ class SQLServer extends Grammar {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the SQL statement for a drop unqiue key command.
|
||||
* Generate the SQL statement for a drop unique key command.
|
||||
*
|
||||
* @param Table $table
|
||||
* @param Fluent $command
|
||||
|
||||
Reference in New Issue
Block a user