@link https://rogerkeays.com/how-to-move-a-node-in-nested-sets-with-sql

@param object $object
@param object $parentObject
@throws IllegalStateException
485066
public function move($object, $parentObject = null) {
		$this->em->flush();
		
		if ($parentObject !== null) {
			$this->valMove($object, $parentObject);
		}
		
		$newLft = 1;
		if ($parentObject === null) {
			if (null !== ($maxRgt = $this->lookupMaxRgt($object))) {
				$newLft = $maxRgt + 1;
			}
		} else {
			$newLft = $this->lookupLftRgt($parentObject)['rgt'];
		}
		
		$this->moveToLft($object, $newLft);
	}
873282
public function setJoin(DataObject $object, $alias = null)
    {
        $this->joinRecord = $object;
        if ($alias) {
            if (static::getSchema()->fieldSpec(static::class, $alias)) {
                throw new InvalidArgumentException(
                    "Joined record $alias cannot also be a db field"
                );
            }
            $this->record[$alias] = $object;
        }
        return $this;
    }
1198671
public function registerInstance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('registerInstance(): Cannot pass primitive types, can only register an object instance; use registerVariable() instead');
        }

        $reflectionObject = new \ReflectionObject($object);
        $className = $reflectionObject->getName();

        // Register strong link in $instance
        $this->instances[$className] = $object;

        // Recursively determine and register weak links
        $determineParent = function (\ReflectionClass $class) use ($className, &$determineParent) {
            $parentClass = $class->getParentClass();

            if (!empty($parentClass)) {
                $this->weakLinks[$parentClass->getName()] = $className;
                $determineParent($parentClass);
            }
        };

        $determineParent($reflectionObject);
    }
627384
public function setParent($parent)
	{
		if ($parent instanceof JCategoryNode || is_null($parent))
		{
			if (!is_null($this->_parent))
			{
				$key = array_search($this, $this->_parent->_children);
				unset($this->_parent->_children[$key]);
			}

			if (!is_null($parent))
			{
				$parent->_children[] = & $this;
			}

			$this->_parent = $parent;

			if ($this->id != 'root')
			{
				if ($this->parent_id != 1)
				{
					$this->_path = $parent->getPath();
				}

				$this->_path[] = $this->id . ':' . $this->alias;
			}

			if (count($parent->_children) > 1)
			{
				end($parent->_children);
				$this->_leftSibling = prev($parent->_children);
				$this->_leftSibling->_rightsibling = & $this;
			}
		}
	}
462975
public function setParent($parent)
    {
        if ($parent !== null && !$parent instanceof self) {
            throw new \InvalidArgumentException('An entry may only have another entry as parent');
        }

        $this->parent = $parent;
    }
538760
final public function internalSetParent(ParentNodeInterface $parent)
    {
        $this->emit('parent.change', [$parent, $this]);
        $this->parentNode = $parent;
    }
70119
protected function makeClearedDataObject($objectClass, array $data, $parentKey = null)
    {
        /** @var AbstractDataObject $object */
        $object = new $objectClass();
        $object->clear();

        try {
            $object->setAttributes($data);

        } catch (ModelConfigurationDataException $e) {

            throw $e->setDotKey(
                $parentKey . ($e->getDotKey() ? '.' . $e->getDotKey() : null)
            );
        }

        return $object;
    }
994556
public function preUpdate($object)
    {
        $this->blockManager->get($object)->preUpdate($object);

        // fix weird bug with setter object not being call
        $object->setChildren($object->getChildren());

        if ($object->getPage() instanceof PageInterface) {
            $object->getPage()->setEdited(true);
        }
    }
1312976
public function remove($object)
    {
        if (!is_object($object) || !($object instanceof $this->objectType)) {
            $type = (is_object($object) ? get_class($object) : gettype($object));
            throw new IllegalObjectTypeException('The value given to remove() was ' . $type . ' , however the ' . get_class($this) . ' can only handle ' . $this->objectType . ' instances.', 1517408067);
        }
        $this->entityManager->remove($object);
    }
582244
public function bindParent($parent, $parentPropertyName=NULL)
	{
		$this->_parent = $parent;
		$this->_parentPropertyName = $parentPropertyName;
		return $this;
	}
177848
private function attachToParent(SwatUIObject $object, SwatUIParent $parent)
    {
        if ($parent instanceof SwatUIParent) {
            $parent->addChild($object);
        } else {
            $class_name = get_class($parent);
            throw new SwatDoesNotImplementException(
                "Can not add object to parent. '{$class_name}' does not " .
                    'implement SwatUIParent.',
                0,
                $parent
            );
        }
    }
402153
public function isHasManyRelation(DataObject $object, $name)
    {
        return (boolean) $this->getSchema()->hasManyComponent($object, $name);
    }
628779
protected function addToDb(Database\Model &$object)
    {
        $this->FKValue[1] = $object->id;
        $this->doQuery($this->addToDbQuery());
    }
128020
public function bind($bindObject) {
        // Loop over object and set property value
        foreach ($bindObject as $key => $value) {
            ObjectUtils::setNestedObjectProperty($value, $this, $key);
        }
    }
1065550
public function postProcessContentObjectInitialization(ContentObjectRenderer &$parentObject)
    {
        if (!empty($parentObject->currentRecord)) {
            list($table) = explode(':', $parentObject->currentRecord);

            if (!empty($table) && $table != 'pages') {
                $this->findFrontendGroups($parentObject->data, $table);
            }
        }
    }
797254
public static function fromObject( $object, $rootName = null, $nodeName = null, $addHeader = true )
    {
        if ( !is_object( $object ) )
        {
            throw new \InvalidArgumentException( 'The value of "$object" is not an object.' );
        }

        return static::fromArray( get_object_vars( $object ), $rootName, $nodeName, $addHeader );
    }
282729
static function insertIntoPool(Model $object) {
		if (
			!static::$_poolEnabled
			|| static::$_instancePoolCount >= static::MAX_INSTANCE_POOL_SIZE
			|| empty(static::$_primaryKeys)
		) {
			return;
		}

		$pool_key = implode('-', $object->getPrimaryKeyValues());
		if (empty($pool_key)) {
			return;
		}

		if (!isset(static::$_instancePool[$pool_key])) {
			++static::$_instancePoolCount;
		}

		static::$_instancePool[$pool_key] = $object;
	}