@param string $partner_id_customer
@param array  $fields

@throws Mollie_Exception
@return SimpleXMLElement
766746
public function accountEditByPartnerId($partner_id_customer, array $fields)
    {
        return $this->performRequest(
            self::METHOD_POST,
            sprintf('/api/reseller/v%d/account-edit', self::API_VERSION),
            ["partner_id_customer" => $partner_id_customer] + $fields
        );
    }
391845
protected function buildRelationshipQuery($field_parameters)
    {
        if (isset($field_parameters['table']) && ! $this->onlyQueryFrom == 'model') {
            $table = $field_parameters['table'];

            return DB::table($table);
        } elseif (isset($field_parameters['model']) && ! $this->onlyQueryFrom == 'table') {
            $class = $field_parameters['model'];
            $model = new $class;

            if ($model instanceof Model) {
                return $model;
            }

            throw new Exception('Class \''.$class.'\' must be an isntance of \''.Model::class.'\'');
        }

        throw new Exception('No valid query to build from field parameters');
    }
770138
public function modifyBooleanField($field, $ids, $status=null)
    {
        $ids = !is_numeric($ids) ? StringHelper::toIntArray($ids) : [$ids];
        
        $ret = 0;
        if ($ids) {
            if (is_null($status)) {
                $set = "{$field} = ({$field} + 1) % 2";
            } else {
                $set = "{$field} = " . intval($status);
            }
            
            $query = $this->getQuery();
            
            if (isset($query['table'])) {
                $pk = $this->getPrimaryKey($query['table'][0]);
            } else {
                $pk = $this->getPrimaryKey();
            }
            
            if (!isset($pk)) {
                throw new Exception('Can\'t get primary key of table:' . $this->getTableName());
            }
            
            $ret = $this->formatted(true)->set($set)->where([$pk => ['in', $ids]])->modify();
        }
        
        return ErrorInfo::instance($ret);
    }
403441
public function getLead($id, $fields = null, $args = array(), $returnRaw = false)
    {
        $args['id'] = $id;

        if (is_array($fields)) {
            $args['fields'] = implode(',', $fields);
        }

        return $this->getResult('getLead', $args, false, $returnRaw);
    }
77224
private function prepareField($field, bool $join = true)
    {
        if ($field == '*') {
            return $field;
        }

        if ($field instanceof Builder || $field instanceof Sql) {
            return '('. $field->toString() .')';
        } elseif ($field instanceof Identifier) {
            return $this->agent->escapeIdentifier($field);
        }

        if (is_string($field)) {
            $field = Util::split(',', trim($field));
        }

        if (is_array($field)) {
            return $this->agent->escapeIdentifier($field, $join);
        }

        throw new BuilderException(sprintf('String, array or Builder type fields are accepted only,'.
            ' %s given', gettype($field)));
    }
1064405
public function renderRelationElement($element, FieldDescriptionInterface $fieldDescription)
    {
        if (!\is_object($element)) {
            return $element;
        }

        $propertyPath = $fieldDescription->getOption('associated_property');

        if (null === $propertyPath) {
            // For BC kept associated_tostring option behavior
            $method = $fieldDescription->getOption('associated_tostring');

            if ($method) {
                @trigger_error(
                    'Option "associated_tostring" is deprecated since version 2.3 and will be removed in 4.0. '
                    .'Use "associated_property" instead.',
                    E_USER_DEPRECATED
                );
            } else {
                $method = '__toString';
            }

            if (!method_exists($element, $method)) {
                throw new \RuntimeException(sprintf(
                    'You must define an `associated_property` option or '.
                    'create a `%s::__toString` method to the field option %s from service %s is ',
                    \get_class($element),
                    $fieldDescription->getName(),
                    $fieldDescription->getAdmin()->getCode()
                ));
            }

            return \call_user_func([$element, $method]);
        }

        if (\is_callable($propertyPath)) {
            return $propertyPath($element);
        }

        return $this->pool->getPropertyAccessor()->getValue($element, $propertyPath);
    }
226483
public function selectAction()
    {
        $selectFieldProviders = $this->get('phlexible_elementtype.select_field_providers');

        $data = [];
        foreach ($selectFieldProviders->all() as $selectFieldProvider) {
            $data[] = [
                'name' => $selectFieldProvider->getName(),
                'title' => $selectFieldProvider->getTitle($this->getUser()->getInterfaceLanguage('en')),
            ];
        }

        return new JsonResponse(['functions' => $data]);
    }
812601
public function index($id = null): Response
    {
        if ($id != null) {
            return $this->getById($id);
        }

        //parse the rquest
        $parse = new QueryParserCustomFields($this->request->getQuery(), $this->model);
        $parse->appendParams($this->additionalSearchFields);
        $parse->appendCustomParams($this->additionalCustomSearchFields);
        $parse->appendRelationParams($this->additionalRelationSearchFields);
        $params = $parse->request();

        $results = (new SimpleRecords(null, $this->model, $this->model->getReadConnection()->query($params['sql'], $params['bind'])));
        $count = $this->model->getReadConnection()->query($params['countSql'], $params['bind'])->fetch(\PDO::FETCH_OBJ)->total;
        $relationships = false;

        // Relationships, but we have to change it to sparo full implementation
        if ($this->request->hasQuery('relationships')) {
            $relationships = $this->request->getQuery('relationships', 'string');
        }

        //navigate los records
        $newResult = [];
        foreach ($results as $key => $record) {
            //field the object
            foreach ($record->getAllCustomFields() as $key => $value) {
                $record->{$key} = $value;
            }

            $newResult[] = !$relationships ? $record->toFullArray() : QueryParserCustomFields::parseRelationShips($relationships, $record);
        }

        unset($results);

        //this means the want the response in a vuejs format
        if ($this->request->hasQuery('format')) {
            $limit = (int)$this->request->getQuery('limit', 'int', 25);

            $newResult = [
                'data' => $newResult,
                'limit' => $limit,
                'page' => $this->request->getQuery('page', 'int', 1),
                'total_pages' => ceil($count / $limit)
            ];
        }

        return $this->response($newResult);
    }
387967
public function getFor(Customer $customer, $subscriptionId, array $parameters = [])
    {
        $this->parentId = $customer->id;

        return parent::rest_read($subscriptionId, $parameters);
    }
156721
public function load($id)
    {

        // if not, try to load the customer with the passed entity ID
        $this->customerAddressStmt->execute(array(MemberNames::ENTITY_ID => $id));
        return $this->customerAddressStmt->fetch(\PDO::FETCH_ASSOC);
    }
725777
public function itemRelist($item_id, $fields)
    {
        // TODO: Tests
        $response = $this->getGuzzleClient()
            ->post(
                '/items/' . $item_id . '/relist',
                array_merge(
                    $this->setQuery(),
                    $this->setBodyArray($fields)
                )
            );

        return $this->serializer->deserialize(
            $response->getBody()->getContents(),
            Item::class,
            'json'
        );
    }
1285059
public Optional<PartnerAccount> show(long partnerId, long accountId)
    {
        return HTTP.GET(String.format("/v2/partners/%d/accounts/%d", partnerId, accountId), PARTNER_ACCOUNT);
    }
1092298
public Collection<PartnerUser> list(long partnerId, long accountId)
    {
        return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), PARTNER_USERS).get();
    }
798292
public function saveRelationship(ManyToManyField $fieldType, ElementInterface $element)
    {
        // Get element ID of the current element
        $targetId = $element->getId();

        // Delete cache related to this element ID
        Craft::$app->templateCaches->deleteCachesByElementId($targetId);

        // Get submitted field value
        $content = $element->getFieldValue($fieldType->handle);

        // There are 3 Items we need to make up a unique relationship in the craft_relations table:
        // fieldId  --> We define this in the Field settings when creating it
        // sourceId --> The elementIds that create the relationship initially. This is currently stored in the $content array
        // targetId --> $elementId, this is the reverse of the relationship
        $fieldId = $fieldType->singleField;

        // The relationships we either want to add or leave
        $toAdd = $content['add'] ?? [];

        // The relationships we want to remove
        $toDelete = $content['delete'] ?? [];

        // First handle adding or updating the relationships that have to exist
        foreach ($toAdd as $sourceId) {
            // Check if relation exists
            $exists = (new Query())
                ->select('id')
                ->from('{{%relations}}')
                ->where('fieldId = :fieldId', [':fieldId' => $fieldId])
                ->andWhere('sourceId = :sourceId', [':sourceId' => $sourceId])
                ->andWhere('targetId = :targetId', [':targetId' => $targetId])
                ->exists();

            // Create relation if it does not exist
            if (!$exists) {
                $columns = [
                    'fieldId' => $fieldId,
                    'sourceId' => $sourceId,
                    'sourceSiteId' => null,
                    'targetId' => $targetId,
                    'sortOrder' => 1,
                ];

                Craft::$app->db->createCommand()->insert('{{%relations}}', $columns)->execute();
            }
        }

        // Now, delete the existing relationships if the user removed them.
        foreach ($toDelete as $sourceId) {
            $oldRelationConditions = [
                'and',
                'fieldId = :fieldId',
                'sourceId = :sourceId',
                'targetId = :targetId',
            ];
            $oldRelationParams = [
                ':fieldId' => $fieldId,
                ':sourceId' => $sourceId,
                ':targetId' => $targetId,
            ];

            Craft::$app->db->createCommand()->delete('{{%relations}}', $oldRelationConditions,
                $oldRelationParams)->execute();
        }
    }
535206
public function customer($id, $email, $attributes)
    {
        $body = array_merge(array('email' => $email), $attributes);

        try {
            $response = $this->client->put('/api/v1/customers/'.$id, array(
                'auth' => $this->auth,
                'json' => $body,
            ));
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        } catch (RequestException $e) {
            return new Response($e->getCode(), $e->getMessage());
        }

        return new Response($response->getStatusCode(), $response->getReasonPhrase());
    }
474471
public function getFieldById($table, $field, $id, $id_col = 'id')
    {
        $options = array('W' => '`' . $id_col . "`='" . $this->escape($id) . "'");

        try {
            return $this->getField($table, $field, $options);
        } catch (\Exception $e) {
            Throw $e;
        }
    }
948555
public function getSignText($data, $partnerId)
    {
        foreach ($data as $key=>$value) {
            if ($value === '' or $value === null) {
                unset($data[$key]);
            }
        }
        ksort($data);

        $str = Helper::setParams($data);
        $str .= "&key=".$partnerId;
        $key = strtoupper(md5($str));

        return $key;
    }