public function getPrevSibling()
    {
        // If parent and children are already loaded, avoid database query
        if($this->parent !== null && ($children = $this->parent->internalGetChildren()) !== null)
        {
            for($i=0; $i<count($children); $i++)
            {
                if($children[$i] == $this)
                {
                    return ($i-1 < 0) ? null : $children[$i-1];
                }
            }
        // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd


        $qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
        $alias = $this->getManager()->getConfiguration()->getQueryBuilderAlias();

        $qb->andWhere("$alias.".$this->getRightFieldName()." = :rgt1")
            ->setParameter('rgt1', $this->getLeftValue() - 1);
        if($this->hasManyRoots())
        {
            $qb->andWhere("$alias.".$this->getRootFieldName()." = :root")
                ->setParameter('root', $this->getRootValue());
        }

        $q = $qb->getQuery();
		if ($this->getManager()->getConfiguration()->isQueryHintSet()){
			$q = $this->getManager()->addHintToQuery($q);
		}
		$results = $q->getResult();

        if(!$results)
        {
            return null;
        }

        return $this->getManager()->wrapNode($results[0]);
    }