/** * Jackalope implements this feature and updates the position of the * existing child at srcChildRelPath to be in the list immediately before * destChildRelPath. * * {@inheritDoc} * * Jackalope has no implementation-specific ordering restriction so no * \PHPCR\ConstraintViolationException is expected. VersionException and * LockException are not tested immediately but thrown on save. * * @api */ public function orderBefore($srcChildRelPath, $destChildRelPath) { if ($srcChildRelPath == $destChildRelPath) { //nothing to move return; } if (null == $this->originalNodesOrder) { $this->originalNodesOrder = $this->nodes; } $this->nodes = NodeHelper::orderBeforeArray($srcChildRelPath, $destChildRelPath, $this->nodes); $this->setModified(); }
/** * @group benchmark */ public function testBenchmarkOrderBeforeArray() { $nodes = array(); for ($i = 0; $i < 100000; $i++) { $nodes[] = 'test' . $i; } $start = microtime(true); NodeHelper::orderBeforeArray('test250', 'test750', $nodes); $this->assertLessThan(1.0, microtime(true) - $start); }