Moves a node or a list of nodes depending on the old parent, the new parent and the referenced node ID.

@param \stdClass $params Associative list of parameters
@return array Associative list with success value
506258
public function moveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items', 'oldparentid', 'newparentid' ) );
		$this->setLocale( $params->site );

		$manager = $this->getManager();

		$ids = [];
		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $id )
		{
			$manager->moveItem( $id, $params->oldparentid, $params->newparentid, $refId );
			$ids[] = $id;
		}

		$this->clearCache( $ids );

		return array(
			'success' => true,
		);
	}
857519
public function getPages(ECParams $params)
    {
        $stmtManager = $this->getStatementManager(Simple::class);

        /** @var Select $stmtBuilder */
        $stmtBuilder = $stmtManager->getStatementBuilder(Select::class);

        /** @var PageCollection $collection */
        $collection = $stmtManager->setStatement($stmtBuilder->setColumns(['stub']))
            ->execute();

        return $collection->setEcParams($params);
    }
502410
public function move(Node $newParent)
    {
        $error = $this->checkMove($newParent);
        if ($error !== null) {
            throw $error;
        }
        if ($this->getTreeNodeParentID() != $newParent->getTreeNodeID()) {
            $db = Database::connection();
            $existingDisplayOrder = $this->treeNodeDisplayOrder;
            $treeNodeDisplayOrder = (int) $db->fetchColumn('select count(treeNodeDisplayOrder) from TreeNodes where treeNodeParentID = ?', [$newParent->getTreeNodeID()]);
            $db->executeQuery('update TreeNodes set treeNodeParentID = ?, treeNodeDisplayOrder = ? where treeNodeID = ?', [$newParent->getTreeNodeID(), $treeNodeDisplayOrder, $this->treeNodeID]);
            if (!$this->overrideParentTreeNodePermissions()) {
                $db->executeQuery('update TreeNodes set inheritPermissionsFromTreeNodeID = ? where treeNodeID = ?', [$newParent->getTreeNodePermissionsNodeID(), $this->treeNodeID]);
            }
            $oldParent = $this->getTreeNodeParentObject();
            if (is_object($oldParent)) {
                // Instead of just rescanning all the nodes (which could take a long time),
                // let's just update all the nodes with display order above this one to be their current
                // order - 1
                $db->executeQuery(
                    'update TreeNodes set treeNodeDisplayOrder = (treeNodeDisplayOrder - 1) 
where treeNodeDisplayOrder > ? and treeNodeParentID = ?',
                    [$existingDisplayOrder, $oldParent->getTreeNodeID()]
                );
                //$oldParent->rescanChildrenDisplayOrder();
                $oldParent->updateDateModified();
            }
            $newParent->updateDateModified();
            $this->treeNodeParentID = $newParent->getTreeNodeID();
            $this->treeNodeDisplayOrder = $treeNodeDisplayOrder;
        }
    }
1099634
public function reverseTransform(FacadeInterface $facade, array $params = array())
    {
        $nodes = array();
        $nodesFacade = $facade->getNodes();
        foreach ($nodesFacade as $nodeFacade) {
            $node = $this->getContext()->reverseTransform('node', $nodeFacade);
            if (null !== $node) {
                $nodes[] = $node;
            }
        }

        return $nodes;
    }
1085257
public function searchItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site' ) );
		$this->_setLocale( $params->site );

		$total = 0;
		$search = $this->_initCriteria( $this->_getManager()->createSearch(), $params );
		$items = $this->_getManager()->searchItems( $search, array(), $total );

		return array(
			'items' => $this->_toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
178311
public function updateDefault(array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::PUT,
            ResourceMethodEnum::UPDATE_DEFAULT,
            $params,
            null
        );
    }
153032
public function routeParams($params = '')
    {
        if (!empty($params)) {
            // Set the property
            if (is_a($params, 'stdClass')) {
                $this->routeParams = $params;
            } else {
                return false;
            }
        } else {
            // Get the property
            return $this->routeParams;
        }
    }
735958
public function loadCategories(\DmsLoaderParams $params)
  {
    $rootCategory = null;
    // if another root category is selected
    if ($params->loadRootCategory && $params->rootCategoryId > 0)
    {
      $rootCategory = $this->loadCategory($params->rootCategoryId, $params);
      
      $arrCategories = $this->getCategoryLevel($params->rootCategoryId, $rootCategory, $params);
      
      if ($params->includeRootCategory)
      {
        $rootCategory->subCategories = $arrCategories;
        $arrCategories = array();
        $arrCategories[] = $rootCategory;
      }
      
      return $arrCategories;
    }
    return $this->getCategoryLevel($params->rootCategoryId, null, $params);
  }
518867
public function insertItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		$ids = array();
		$manager = $this->_getManager();

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$parentId = ( isset( $params->parentid ) ? $params->parentid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $this->_createItem( (array) $entry );
			$manager->insertItem( $item, $parentId, $refId );

			$ids[] = $item->getId();
		}

		$this->_clearCache( $ids );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', 'catalog.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );
		$items = $this->_toArray( $manager->searchItems( $search ) );

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
183131
private function replaceParameterAssignWithOptionAssign(array $nodes, Param $param): array
    {
        foreach ($nodes as $expression) {
            if (! $expression instanceof Expression) {
                continue;
            }

            $node = $expression->expr;
            if (! $node instanceof Assign) {
                continue;
            }

            $variableName = $this->getName($node->var);
            if ($variableName === null) {
                continue;
            }

            if ($node->expr instanceof Variable) {
                $node->expr = new ArrayDimFetch($param->var, new String_($variableName));
            }
        }

        return $nodes;
    }
99025
protected function actionAdd($params=array())
    {
        $response = array(
            'errors' => array(),
            'data' => array(),
        );
        $values = $this->rubric->prepareParams($params);
        if (empty($values['name'])) {
            $response['errors'][] = 'rbr01';
        } elseif (!$this->checkName($values['name'])) {
            $response['errors'][] = 'rbr03';
        }
        if ($values['parent'] != 'root') {
            $filter = array(
                'fields' => array(
                    array(
                        'field' => 'id',
                        'compare' => '=',
                        'value' => $values['parent'],
                    ),
                ),
            );
            $isset = $this->rubric->find($filter);
            if (!$isset) {
                $response['errors'][] = 'rbr02';
            }
        }
        if ($this->checkExists($values['id'])) {
            $response['errors'][] = 'rbr04';
            $response['data']['id'] = $values['id'];
        }
        if (!empty($response['errors'])) {
            return $response;
        }
        $result = $this->rubric->add($values);
        if ($result) {
            $response['data']['id'] = $values['id'];
        } else {
            $response['errors'][] = 'err01';
        }
        return $response;
    }
1257054
public function searchItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site' ) );
		$this->setLocale( $params->site );

		$total = 0;
		$manager = $this->getManager();
		$search = $this->initCriteria( $manager->createSearch(), $params );
		$items = $manager->searchItems( $search, [], $total );

		return array(
			'items' => $this->toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
988166
public function insertItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'items' ) );

		$manager = $this->_getManager();

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$parentId = ( ( isset( $params->parentid ) && $params->parentid !== 'root' ) ? $params->parentid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $this->_createItem( (array) $entry );
			$manager->insertItem( $item, $parentId, $refId );

			$entry->{'locale.site.id'} = $item->getId();
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
330618
public function searchItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site' ) );
		$this->setLocale( $params->site );

		$total = 0;
		$search = $this->initCriteria( $this->getManager()->createSearch(), $params );

		if( isset( $params->domain ) && isset( $params->parentid )
			&& ( !isset( $params->options->showall ) || $params->options->showall == false ) )
		{
			$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $params->domain . '/lists' );
			$criteria = $listManager->createSearch();

			$expr = [];
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.parentid', $params->parentid );
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.domain', 'price' );
			$criteria->setConditions( $criteria->combine( '&&', $expr ) );

			$result = $listManager->searchItems( $criteria );

			$ids = [];
			foreach( $result as $items ) {
				$ids[] = $items->getRefId();
			}

			$expr = [];
			$expr[] = $search->compare( '==', 'price.id', $ids );
			$expr[] = $search->getConditions();
			$search->setConditions( $search->combine( '&&', $expr ) );
		}

		$items = $this->getManager()->searchItems( $search, [], $total );

		return array(
			'items' => $this->toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
483908
public function findOneByParams(array $params = [])
    {
        $params['limit'] = 1;
        $records = $this->findByParams($params);
        if (count($records) > 0) {
            return $records->rewind();
        }

        return null;
    }
1198253
public function getTree( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		$manager = $this->getManager();

		$result = [];
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			if( $entry == 'root' )
			{
				$search = $this->manager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );

				$item = $this->manager->createItem();
				$item->setLabel( 'Root' );

				foreach( $this->manager->searchItems( $search ) as $siteItem ) {
					$item->addChild( $siteItem );
				}
			}
			else
			{
				$item = $manager->getTree( $entry, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );
			}

			$result[] = $this->createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
729966
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$ids = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );
			$ids[] = $item->getId();
		}

		$this->clearCache( $ids );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', 'service.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );
		$result = $manager->searchItems( $search );

		foreach( $result as $item ) {
			$this->checkConfig( $item );
		}

		$items = $this->toArray( $result );

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}