fixing merge conflicts.

This commit is contained in:
Taylor Otwell 2012-04-01 13:51:59 -05:00
commit f97f73a835
7 changed files with 49 additions and 11 deletions

View File

@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.1.2
* @version 3.1.4
* @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com
*/

View File

@ -4,6 +4,10 @@ ## Contents
- [Laravel 3.2](#3.2)
- [Upgrading From 3.1](#upgrade-3.2)
- [Laravel 3.1.4](#3.1.4)
- [Upgrading From 3.1.3](#upgrade-3.1.4)
- [Laravel 3.1.3](#3.1.3)
- [Upgrading From 3.1.2](#uprade-3.1.3)
- [Laravel 3.1.2](#3.1.2)
- [Upgrading From 3.1.1](#upgrade-3.1.2)
- [Laravel 3.1.1](#3.1.1)
@ -26,6 +30,27 @@ ## Upgrading From 3.1
- Replace the **laravel** folder.
- Add new **vendors** folder.
<a name="3.1.4"></a>
## Laravel 3.1.4
- Fixes Response header casing bug.
- Fixes SQL "where in" (...) short-cut bug.
<a name="upgrade-3.1.4"></a>
## Upgrading From 3.1.3
- Replace the **laravel** folder.
<a name="3.1.3"></a>
## Laravel 3.1.3
- Fixes **delete** method in Eloquent models.
<a name="upgrade-3.1.3"></a>
## Upgrade From 3.1.2
- Replace the **laravel** folder.
<a name="3.1.2"></a>
## Laravel 3.1.2

View File

@ -385,6 +385,19 @@ public function save()
return $result;
}
/**
* Delete the model from the database.
*
* @return int
*/
public function delete()
{
if ($this->exists)
{
return $this->query()->where(static::$key, '=', $this->get_key())->delete();
}
}
/**
* Set the update and creation timestamps on the model.
*

View File

@ -170,9 +170,7 @@ public function insert($attributes, $joining = array())
*/
public function delete()
{
$id = $this->base->get_key();
return $this->joining_table()->where($this->foreign_key(), '=', $id)->delete();
return $this->pivot()->delete();
}
/**

View File

@ -397,22 +397,24 @@ public function delete(Query $query)
* @param array $bindings
* @return string
*/
public function shortcut($sql, $bindings)
public function shortcut($sql, &$bindings)
{
// Laravel provides an easy short-cut notation for writing raw WHERE IN
// statements. If (...) is in the query, it will be replaced with the
// correct number of parameters based on the bindings.
// correct number of parameters based on the query bindings.
if (strpos($sql, '(...)') !== false)
{
for ($i = 0; $i < count($bindings); $i++)
{
// If the binding is an array, we can just assume it's used to
// fill a "where in" condition, so we will just replace the
// next place-holder in the query with the constraint.
// If the binding is an array, we can just assume it's used to fill a
// where in condition, so we'll just replace the next place-holder
// in the query with the constraint and splice the bindings.
if (is_array($bindings[$i]))
{
$parameters = $this->parameterize($bindings[$i]);
array_splice($bindings, $i, 1, $bindings[$i]);
$sql = preg_replace('~\(\.\.\.\)~', "({$parameters})", $sql, 1);
}
}

View File

@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.1.2
* @version 3.1.4
* @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com
*/

View File

@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.1.2
* @version 3.1.4
* @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com
*/