/** * Test cases for depth when moving nodes */ public function testDepthOnMove() { $root = $this->session->getNode('/'); $topic1 = $root->addNode('topic1'); $topic2 = $root->addNode('topic2'); $topic3 = $root->addNode('topic3'); $topic1->addNode('page1'); $topic2->addNode('page2'); $topic3->addNode('page3'); $this->session->save(); $this->transport->moveNodeImmediately('/topic2/page2', '/topic1/page1/page2'); $this->transport->moveNodeImmediately('/topic3', '/topic1/page1/page2/topic3'); $conn = $this->getConnection(); $qb = $conn->createQueryBuilder(); $qb->select('local_name, depth')->from('phpcr_nodes', 'n')->where('n.path = :path'); $query = $qb->getSql(); $stmnt = $this->conn->executeQuery($query, array('path' => '/topic1/page1/page2')); $row = $stmnt->fetch(); $this->assertEquals($row['depth'], '3'); $stmnt = $this->conn->executeQuery($query, array('path' => '/topic1/page1/page2/topic3/page3')); $row = $stmnt->fetch(); $this->assertEquals($row['depth'], '5'); }
/** * {@inheritDoc} */ public function moveNodeImmediately($srcAbsPath, $dstAbsPath) { $result = parent::moveNodeImmediately($srcAbsPath, $dstAbsPath); if ($result) { $this->clearCaches(); } return $result; }
/** * {@inheritDoc} */ public function moveNodeImmediately($srcAbsPath, $dstAbsPath) { $result = parent::moveNodeImmediately($srcAbsPath, $dstAbsPath); if ($result && isset($this->caches['nodes'])) { $this->caches['nodes']->deleteAll(); } return $result; }