Skip to content

Commit

Permalink
Backport bugfixes from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepat committed Mar 4, 2015
1 parent f2033b0 commit 2e9c9e2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 1.0.15
_Mar 4 2015_
* bug fixes
- Backport minor bugfixes from master.

## 1.0.14
_Mar 3 2014_
_Mar 3 2015_
* bug fixes
- Backwards compatible version for Laravel 4.2.x.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ You can ask some questions to your Baum nodes:
* `isAncestorOf($other)`: Returns true if node is an ancestor of the other.
* `isSelfOrAncestorOf($other)`: Returns true if node is self or an ancestor.
* `equals($node)`: current node instance equals the other.
* `insideSubtree($node)`: Checks wether the given node is inside the subtree
* `insideSubtree($node)`: Checks whether the given node is inside the subtree
defined by the left and right indices.
* `inSameScope($node)`: Returns true if the given node is in the same scope
as the current one. That is, if *every* column in the `scoped` property has
Expand Down Expand Up @@ -475,7 +475,7 @@ Retrieving a complete tree hierarchy into a regular `Collection` object with
its children *properly nested* is as simple as:

```php
$tree = Category::where('name', '=', Books)->first()->getDescendantsAndSelf()->toHierarchy();
$tree = Category::where('name', '=', 'Books')->first()->getDescendantsAndSelf()->toHierarchy();
```

<a name="node-model-events"></a>
Expand Down
2 changes: 1 addition & 1 deletion src/Baum/BaumServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BaumServiceProvider extends ServiceProvider {
*
* @var string
*/
const VERSION = '1.0.14';
const VERSION = '1.0.15';

/**
* Indicates if loading of the provider is deferred.
Expand Down
3 changes: 2 additions & 1 deletion src/Baum/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ public function scopeWithoutRoot($query) {
public function scopeLimitDepth($query, $limit) {
$depth = $this->exists ? $this->getDepth() : $this->getLevel();
$max = $depth + $limit;
$scopes = array($depth, $max);

return $query->whereBetween($this->getDepthColumnName(), array($depth, $max));
return $query->whereBetween($this->getDepthColumnName(), array(min($scopes), max($scopes)));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Baum/SetValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function validateBounds() {
$qualifiedRgtCol >= parent.$rgtCol)))";

$query = $this->node->newQuery()
->join($connection->raw($grammar->wrap($tableName).' AS parent'),
->join($connection->raw($grammar->wrapTable($tableName).' AS parent'),
$parentColumn, '=', $connection->raw('parent.'.$grammar->wrap($primaryKeyName)),
'left outer')
->whereRaw($whereStm);
Expand Down

0 comments on commit 2e9c9e2

Please sign in to comment.