Sends a single location identified by given $locationId to the trash.

The associated content object is left untouched.

@param mixed $locationId

@return bool
760552
public function trashLocation($locationId)
    {
        try {
            return $this->innerGateway->trashLocation($locationId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
996766
public function getPath($locationId, array $options = []): array
    {
        $optionsResolver = new OptionsResolver();
        $this->configureOptions($optionsResolver);
        $options = $optionsResolver->resolve($options);

        $excludedContentTypes = [];
        if (
            !$options['use_all_content_types'] &&
            $this->configResolver->hasParameter('path_helper.excluded_content_types', 'ngsite')
        ) {
            $excludedContentTypes = $this->configResolver->getParameter('path_helper.excluded_content_types', 'ngsite');
            if (!is_array($excludedContentTypes)) {
                $excludedContentTypes = [];
            }
        }

        // The root location can be defined at site access level
        $rootLocationId = (int) $this->configResolver->getParameter('content.tree_root.location_id');

        $path = $this->loadService->loadLocation($locationId)->path;

        // Shift of location "1" from path as it is not a fully valid location and not readable by most users
        array_shift($path);

        $pathArray = [];
        $rootLocationFound = false;
        foreach ($path as $index => $pathItem) {
            if ((int) $pathItem === $rootLocationId) {
                $rootLocationFound = true;
            }

            if (!$rootLocationFound) {
                continue;
            }

            try {
                $location = $this->loadService->loadLocation($pathItem);
            } catch (UnauthorizedException $e) {
                return [];
            }

            if (!in_array($location->contentInfo->contentTypeIdentifier, $excludedContentTypes, true)) {
                $pathArray[] = [
                    'text' => $location->contentInfo->name,
                    'url' => $location->id !== (int) $locationId ?
                        $this->router->generate(
                            $location,
                            [],
                            $options['absolute_url'] ?
                                UrlGeneratorInterface::ABSOLUTE_URL :
                                UrlGeneratorInterface::ABSOLUTE_PATH
                        ) :
                        false,
                    'location' => $location,
                ];
            }
        }

        return $pathArray;
    }
640320
public function matchLocation(APILocation $location)
    {
        $parentContentType = $this->repository->sudo(
            function (Repository $repository) use ($location) {
                $parent = $repository->getLocationService()->loadLocation($location->parentLocationId);

                return $repository
                    ->getContentTypeService()
                    ->loadContentType($parent->getContentInfo()->contentTypeId);
            }
        );

        return isset($this->values[$parentContentType->identifier]);
    }
616241
public static function createRedirectResponse(string $location): ResponseInterface
    {
        if (empty($location)) {

            throw new InvalidArgumentException("Location header value cannot be empty");

        }

        $response = new Response(302);
        return $response->withHeader("Location", $location);
    }
800746
protected function translateLocationId($oldLocationId)
    {
        $location = ScoolLocation::where('name',Location::findOrFail($oldLocationId)->name)->first();
        if ( $location != null ) {
            return $location->id;
        }
        throw new LocationNotFoundByNameException();
    }
90792
public function get($locationId, array $params = array())
    {
        $endpoint = '/admin/locations/'.$locationId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Location::class, $response['location']);
    }
1317863
private function _locationsById(int $id): Location
    {
        $curlClient = curl_init(self::BASE_URL . self::LOCATIONS_URL . '/' . $id);
        curl_setopt($curlClient, CURLOPT_HTTPHEADER, $this->_curlHeader);
        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, true);
        $result = json_decode(curl_exec($curlClient), true);
        return Location::create($result);
    }
186951
public function setSectionForSubtree($locationId, $sectionId)
    {
        $nodeData = $this->locationGateway->getBasicNodeData($locationId);

        $this->locationGateway->setSectionForSubtree($nodeData['path_string'], $sectionId);
    }
80089
public function move($destinationId){
        $parameter = new ClientValueObject();
        $parameter->setProperty("DestinationId",$destinationId);
        $qry = new InvokePostMethodQuery($this->getResourcePath(),"Move",null,$parameter);
        $this->getContext()->addQuery($qry);
    }
1018088
protected function getUrlAliasesForLocation(int $locationId): array
    {
        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder
            ->select(
                't1.id',
                't1.is_original',
                't1.lang_mask',
                't1.link',
                't1.parent',
                // show existing parent only if its row exists, special case for root parent
                'CASE t1.parent WHEN 0 THEN 0 ELSE t2.id END AS existing_parent',
                't1.text_md5'
            )
            ->from($this->table, 't1')
            // selecting t2.id above will result in null if parent is broken
            ->leftJoin('t1', $this->table, 't2', $queryBuilder->expr()->eq('t1.parent', 't2.id'))
            ->where(
                $queryBuilder->expr()->eq(
                    't1.action',
                    $queryBuilder->createPositionalParameter("eznode:{$locationId}")
                )
            );

        return $queryBuilder->execute()->fetchAll(FetchMode::ASSOCIATIVE);
    }
570935
private function loadLocation($locationId): Location
    {
        $location = $this->repository->sudo(
            function (Repository $repository) use ($locationId) {
                return $repository->getLocationService()->loadLocation($locationId);
            }
        );

        return $location;
    }
609461
public function updateLocation(Location $location, $andFlush = true)
    {
        $this->objectManager->persist($location);
        if ($andFlush) {
            $this->objectManager->flush();
        }
    }
1147327
public function getLocationName($locationId): ?string
    {
        try {
            $location = $this->loadService->loadLocation($locationId);
        } catch (UnauthorizedException | NotFoundException | TranslationNotMatchedException $e) {
            return null;
        }

        return $location->content->name;
    }
853243
public function loadLocationEntries($locationId, $custom = false, $languageId = false)
    {
        try {
            return $this->innerGateway->loadLocationEntries($locationId, $custom);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
90723
private function loadLocationFromModel($locationId = 0)
    {
        $locationId = $locationId ? : $this->model->selectedLocation;
        if ($locationId) {
            $locations = SuperCMSUser::getUserLocations()->filter(new Equals('LocationID', $locationId));
            if ($locations->count()) {
                return $locations[0];
            }
        }
        return false;
    }
857951
public function update(UpdateStruct $location, $locationId)
    {
        try {
            return $this->innerGateway->update($location, $locationId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
581670
public function getChildren($locationId)
    {
        $query = $this->handler->createSelectQuery();
        $query->select('*')->from(
            $this->handler->quoteTable('ezcontentobject_tree')
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('parent_node_id', 'ezcontentobject_tree'),
                $query->bindValue($locationId, null, \PDO::PARAM_INT)
            )
        );
        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }