@param array|JsonSerializable|CheckoutPage $data
@param string $checkoutPageId

@throws UnprocessableEntityException The input data does not valid

@return CheckoutPage
344867
public function create($data, $checkoutPageId = null)
    {
        if (isset($checkoutPageId)) {
            return $this->client()->put($data, 'checkout-pages/{checkoutPageId}', ['checkoutPageId' => $checkoutPageId]);
        }

        return $this->client()->post($data, 'checkout-pages');
    }
202498
public function checkoutNewSubscription(array $data = [], array $headers = [])
    {
        $url = $this->url('hosted_pages/checkout_new');

        return $this->post($url, $data, $headers);
    }
107061
public PageResult<Entity> page(Entity where, Page page, String... selectFields) throws SQLException{
		return db.page(Arrays.asList(selectFields), fixEntity(where), page);
	}
443922
public function addPage(SearchPageData $data)
    {
        $url = $data->getUrl();
        $this->pages[$url] = array(
            'title' => $data->getTitle(),
            'text'  => $data->getContents(),
            'tags'  => $data->getTags(true),
            'url'   => $url,
        );

        return $this;
    }
861182
public function findPageBy($page, $rpp, array $criteria = [], array $orderBy = null, $hydrateMode = AbstractQuery::HYDRATE_OBJECT)
    {
        $qb = $this->createPaginatedQueryBuilder($criteria, null, $orderBy);
        $qb->addSelect($this->getEntityAlias());
        $this->processOrderBy($qb, $orderBy);
        $qb->addPagination($page, $rpp);

        $results = $qb->getQuery()->getResult($hydrateMode);
        $total = $this->countBy($criteria);

        return new PaginatedArrayCollection($results, $page, $rpp, $total);
    }
380155
public function getSurveyPage($surveyId, $pageId)
	{
		return $this->sendRequest(
			$this->createRequest('GET', sprintf('surveys/%d/pages/%d', $surveyId, $pageId))
		);
	}
259975
public function createForId($profileId, $methodId, array $data = [])
    {
        $this->parentId = $profileId;
        $resource = $this->getResourcePath() . '/' . urlencode($methodId);

        $body = null;
        if (count($data) > 0) {
            $body = json_encode($data);
        }

        $result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body);

        return ResourceFactory::createFromApiResult($result, new Method($this->client));
    }
28413
public static function unParsePageId($unParsedPageId, $returnFirstEl = true)
    {
        $parts = explode(',', $unParsedPageId);
        return $returnFirstEl ? $parts[0] : $parts;
    }
636724
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false)
    {
        $implementor = $this->getEntityImplementor();

        if (!class_exists($implementor, true)) {
            throw new InvalidTypeException(
                "Unable to resolve the given entity implementor '$implementor' upon entity creation request."
            );
        }

        return new $implementor($this, $data, $parent_entity, $apply_default_values);
    }
322394
public function updateSurveyPage($surveyId, $pageId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PATCH', sprintf('surveys/%d/pages/%d', $surveyId, $pageId), [], $data)
		);
	}
837405
public function getParentByPageId($pageId)
    {
        $data = array();
        $success = 0;

        $treeSite = $this->getServiceLocator()->get('MelisSiteTree');

        if($treeSite){
            $data  = $treeSite->getParentByPageId($pageId);
        }


        return $data;
    }
333133
public function findOrganizationPage($organizationId, $pageId)
    {
        list($response) = $this->findOrganizationPageWithHttpInfo($organizationId, $pageId);
        return $response;
    }
1173987
public function post(Request $request, Fractal $fractal, InputGateContract $inputGate)
    {
        $this->beforeRequest($request, func_get_args());
        $input = $request->json()->all();
        if (!is_array($input) || empty($input)) {
            throw new UnprocessableEntityHttpException("Invalid request body");
        }
        $attributes = $originalAttributes = array_get($input, 'data.attributes', []);
        $relationships = array_get($input, 'data.relationships', []);
        $model = $this->getRepository()->model();
        $attributes = $inputGate->process($model, $attributes, 'create');
        $validatedRelationshipData = $this->validateRelationshipData($model, $relationships, 'create');
        if (!empty($attributes) 
            && ($model = $this->getRepository()->create($attributes, app('context')))
            && $this->saveRelationshipData($validatedRelationshipData)
        ) {
            return $this->respondWithCreated(
                $fractal->createData(new FractalItem($this->getRepository()->findById($model->id), $this->getTransformer(), $this->getResourceKey()))
            );
        }
        throw ServerErrorHttpException("Unable to save object. Try again later.");
    }
157802
public function getClosureByPageId($pageId)
    {
        return $queryBuilder = function (EntityRepository $er) use ($pageId) {
            $qb = $er->createQueryBuilder('p');
            $qb2 = $er->createQueryBuilder('p2');
            $qb->andWhere(
                $qb->expr()->in(
                    'p.locale',
                    $qb2->select('p2.locale')
                        ->where('p2.id = :id')->getDql()
                )
            );

            $qb->setParameter('id', $pageId);

            return $qb;
        };
    }
51112
public function replaceSurveyPage($surveyId, $pageId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PUT', sprintf('surveys/%d/pages/%d', $surveyId, $pageId), [], $data)
		);
	}
732998
public function getById(string $cartId): Checkout
    {
        $qb = $this->connection->createQueryBuilder();
        $qb->select(
            'id', 'billing_address_name', 'billing_address_street', 'billing_address_post_code', 'billing_address_city',
            'billing_address_country_iso2code', 'shipping_address_name', 'shipping_address_street',
            'shipping_address_post_code', 'shipping_address_city', 'shipping_address_country_iso2code'
        )
            ->from('dumplie_customer_checkout')
            ->where('id = :id')
            ->setParameter('id', $cartId);

        $checkoutData = $this->connection->fetchAssoc($qb->getSQL(), $qb->getParameters());

        if (empty($checkoutData)) {
            throw QueryException::cartNotFound($cartId);
        }

        return new Checkout(
            new CartId($cartId),
            new Address(
                $checkoutData['billing_address_name'],
                $checkoutData['billing_address_street'],
                $checkoutData['billing_address_post_code'],
                $checkoutData['billing_address_city'],
                $checkoutData['billing_address_country_iso2code']
            ),
            new Address(
                $checkoutData['shipping_address_name'],
                $checkoutData['shipping_address_street'],
                $checkoutData['shipping_address_post_code'],
                $checkoutData['shipping_address_city'],
                $checkoutData['shipping_address_country_iso2code']
            )
        );
    }
378059
public function saveDuplicateFromPostData($pagePost, $pageLangPost, $pageGroupsPost, $pageInfoOther = [])
    {
        /** @var Page $duplicatePage */
        $duplicatePage = $this->replicate();
        $duplicatePage->setRelations([]);

        $pageLangPost['name'] = preg_replace('/\s+Duplicate$/', '', $pageLangPost['name']) . ' Duplicate';
        $pageLangPost['url'] = preg_replace('/--v\w+$/', '', $pageLangPost['url']) . '--v' . base_convert(microtime(true), 10, 36);
        $pageVersion = PageVersion::prepareNew();
        $pageVersion->template = $duplicatePage->template;

        if ($duplicatePage->savePostData($pageVersion, $pagePost, $pageLangPost, $pageGroupsPost, $pageInfoOther)) {

            // duplicate role actions from original page
            foreach (UserRole::all() as $role) {
                /** @var \Illuminate\Database\Eloquent\Relations\BelongsToMany $pageActionsRelation */
                $pageActionsRelation = $role->page_actions();
                /** @var Collection $pageActions */
                $pageActions = $pageActionsRelation->where('page_id', '=', $duplicatePage->id)->get();
                if (!$pageActions->isEmpty()) {
                    foreach ($pageActions as $pageAction) {
                        $pageActionsRelation->attach($duplicatePage->id, ['action_id' => $pageAction->pivot->action_id, 'access' => $pageAction->pivot->access]);
                    }
                }
            }

            return $duplicatePage;
        } else {
            return false;
        }
    }