Skip to content

Commit 6da0552

Browse files
committed
Removed newFromBuilder dependency
1 parent c3cc494 commit 6da0552

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

src/NodeTrait.php

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait NodeTrait
3131
*
3232
* @var array
3333
*/
34-
protected $pending = [ 'root' ];
34+
protected $pending;
3535

3636
/**
3737
* Whether the node has moved since last save.
@@ -119,14 +119,6 @@ protected function setAction($action)
119119
return $this;
120120
}
121121

122-
/**
123-
* Clear pending action.
124-
*/
125-
protected function clearAction()
126-
{
127-
$this->pending = null;
128-
}
129-
130122
/**
131123
* Call pending action.
132124
*
@@ -136,6 +128,10 @@ protected function callPendingAction()
136128
{
137129
$this->moved = false;
138130

131+
if ( ! $this->pending && ! $this->exists) {
132+
$this->makeRoot();
133+
}
134+
139135
if ( ! $this->pending) return;
140136

141137
$method = 'action'.ucfirst(array_shift($this->pending));
@@ -705,19 +701,6 @@ public function newCollection(array $models = array())
705701
return new Collection($models);
706702
}
707703

708-
/**
709-
* {@inheritdoc}
710-
*/
711-
public function newFromBuilder($attributes = array(), $connection = null)
712-
{
713-
/** @var self $instance */
714-
$instance = parent::newFromBuilder($attributes, $connection);
715-
716-
$instance->clearAction();
717-
718-
return $instance;
719-
}
720-
721704
/**
722705
* {@inheritdoc}
723706
*

0 commit comments

Comments
 (0)