{@inheritDoc}

@since 0.10.0
330105
@Override
    protected long checksum() {
        Map<String, Object> attrs = getAttributes();
        if (attrs == null) {
            return 0;
        }
        if (dataJson != null) {
            attrs.put(ATTR_DATA, dataJson);
        }
        return HashUtils.checksum(attrs, HashUtils.murmur3);
    }
912037
public function index() {
		$this->disableCache();
		$defaultConfig = $this->Setting->getDefaultConfig();
		$currentConfig = (array)$this->Setting->getConfig();
		$configUIlangs = $this->ConfigSettingsApp->getFlagConfigUiLangs();
		$configSMTP = $this->ConfigSettingsApp->getFlagConfigSmtp();
		$configAcLimit = $this->ConfigSettingsApp->getFlagConfigAcLimit();
		$configADsearch = $this->ConfigSettingsApp->getFlagConfigADsearch();
		$configExtAuth = $this->ConfigSettingsApp->getFlagConfigExtAuth();
		$authGroups = $this->ConfigSettingsApp->getAuthGroups();
		$groupList = $this->Ldap->getGroupList();
		$containerList = $this->Ldap->getTopLevelContainerList();
		$currLanguage = Hash::get($currentConfig, 'Setting.Language');
		$languages = $this->Setting->getUiLangsList();
		$schema = $this->Setting->getFullSchema();
		$passFields = [];
		foreach ($schema as $field => $metadata) {
			if (mb_stripos($field, 'password') !== false) {
				$passFields[] = $field;
			}
		}
		if ($this->request->is(['post', 'put'])) {
			foreach ($passFields as $passField) {
				if (mb_stripos($field, '_confirm') !== false) {
					continue;
				}

				$currPass = $this->request->data('Setting.' . $passField);
				$prevPpass = (string)Hash::get($currentConfig, 'Setting.' . $passField);
				if (empty($currPass) && !empty($prevPpass)) {
					$this->request->data('Setting.' . $passField, $prevPpass);
					$this->request->data('Setting.' . $passField . '_confirm', $prevPpass);
				}
			}
			$country = $this->request->data('Setting.Language');
			$language = $this->Setting->getLanguageByCountryCode($country);
			$this->request->data('Setting.Language', $language);
			if ($this->Setting->save($this->request->data)) {
				$this->Flash->success(__d('cake_settings_app', 'Application settings has been saved.'));
				if ($currLanguage !== $language) {
					$this->Flash->information(__d('cake_settings_app', 'Reload the page to apply the settings.'));
				}
				if (!$this->Session->read('Settings.FirstLogon')) {
					$this->ViewExtension->setProgressSseTask('ClearCache');
				}

				return $this->redirect(['action' => 'index']);
			} else {
				$this->Flash->error(__d('cake_settings_app', 'Unable to save application settings.'));
			}
		} else {
			$appSetting = Hash::merge(
				$defaultConfig,
				$currentConfig
			);
			$this->request->data('Setting', $appSetting['Setting']);
			$this->Setting->createValidationRules();
		}
		foreach ($passFields as $passField) {
			$this->request->data('Setting.' . $passField, '');
			$this->request->data('Setting.' . $passField . '_confirm', '');
		}

		$country = $this->Setting->getCountryCodeByLanguage($currLanguage);
		$this->request->data('Setting.Language', $country);
		$varsExt = $this->Setting->getVars();

		$pageHeader = __d('cake_settings_app', 'Application settings');
		$breadCrumbs = $this->Setting->getBreadcrumbInfo();
		$breadCrumbs[] = __d('cake_settings_app', 'Settings');

		$this->set(compact(
			'groupList',
			'containerList',
			'configUIlangs',
			'configSMTP',
			'configAcLimit',
			'configADsearch',
			'configExtAuth',
			'authGroups',
			'languages',
			'varsExt',
			'pageHeader',
			'breadCrumbs'
		));
	}
900002
public function __isset($key)
    {
        if (!isset($this->_object) && $key == $this->_property) {
            return isset($this->_value);
        }

        return parent::__isset($key);
    }
1173885
public function validate($entity, Constraint $constraint): void
    {
        /** @var HasEnabledEntity $constraint */
        Assert::isInstanceOf($constraint, HasEnabledEntity::class);

        $enabled = $this->accessor->getValue($entity, $constraint->enabledPath);

        if ($enabled === true) {
            return;
        }

        $objectManager = $this->getProperObjectManager($constraint->objectManager, $entity);

        $this->ensureEntityHasProvidedEnabledField($objectManager, $entity, $constraint->enabledPath);

        $criteria = [$constraint->enabledPath => true];

        $repository = $objectManager->getRepository(get_class($entity));
        $results = $repository->{$constraint->repositoryMethod}($criteria);

        /* If the result is a MongoCursor, it must be advanced to the first
         * element. Rewinding should have no ill effect if $result is another
         * iterator implementation.
         */
        if ($results instanceof \Iterator) {
            $results->rewind();
        } elseif (is_array($results)) {
            reset($results);
        }

        if ($this->isLastEnabledEntity($results, $entity)) {
            $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $constraint->enabledPath;

            $this->context->buildViolation($constraint->message)->atPath($errorPath)->addViolation();
        }
    }
1173535
public function search(array $data = [])
    {
        if (is_null($this->schema)) {
            throw SystemException::forNoSchema();
        }

        $sum = null;
        $filter = [];
        $like = [];
        $in = [];
        $json = [];
        $span  = [];
        $range = 50;
        $start = 0;
        $order = [];
        $count = 0;

        if (isset($data['filter']) && is_array($data['filter'])) {
            $filter = $data['filter'];
        }

        //Legacy TODO: remove
        if (isset($data['like_filter']) && is_array($data['like_filter'])) {
            $like = $data['like_filter'];
        }

        if (isset($data['like']) && is_array($data['like'])) {
            $like = $data['like'];
        }

        //Legacy TODO: remove
        if (isset($data['in_filter']) && is_array($data['in_filter'])) {
            $in = $data['in_filter'];
        }

        if (isset($data['in']) && is_array($data['in'])) {
            $in = $data['in'];
        }

        //Legacy TODO: remove
        if (isset($data['json_filter']) && is_array($data['json_filter'])) {
            $json = $data['json_filter'];
        }

        if (isset($data['span']) && is_array($data['span'])) {
            $span = $data['span'];
        }

        if (isset($data['range']) && is_numeric($data['range'])) {
            $range = $data['range'];
        }

        if (isset($data['start']) && is_numeric($data['start'])) {
            $start = $data['start'];
        }

        if (isset($data['order']) && is_array($data['order'])) {
            $order = $data['order'];
        }

        if (isset($data['sum']) && !empty($data['sum'])) {
            $sum = sprintf('sum(%s) as total', $data['sum']);
        }

        $active = $this->schema->getActiveFieldName();
        if ($active && !isset($filter[$active])) {
            $filter[$active] = 1;
        }

        $table = $this->schema->getName();
        $search = $this->resource
            ->search($table)
            ->setStart($start);

        if ($range) {
            $search->setRange($range);
        }

        // collect searchable
        $searchable = $this->schema->getSearchableFieldNames();

        // collect json fields
        $fields = $this->schema->getJsonFieldNames();

        //consider forward relations
        $relations = $this->schema->getRelations();
        foreach ($relations as $joinTable => $relation) {
            //deal with post_post at a later time
            if ($table === $relation['name']) {
                continue;
            }

            //1:1
            if ($relation['many'] == 1) {
                $search
                    ->innerJoinUsing(
                        $joinTable,
                        $relation['primary1']
                    )
                    ->innerJoinUsing(
                        $relation['name'],
                        $relation['primary2']
                    );

                //add to searchable
                $searchable = array_merge($searchable, $relation['searchable']);
            //needs to have a filter to add the other kinds of joins
            } else if (!isset($filter[$relation['primary2']])
                && !isset($in[$relation['primary2']])
            ) {
                continue;
            //1:0, 1:N, N:N
            } else {
                $search
                    ->innerJoinUsing(
                        $joinTable,
                        $relation['primary1']
                    )
                    ->innerJoinUsing(
                        $relation['name'],
                        $relation['primary2']
                    );
            }

            $relatedJson = Schema::i($relation['name'])->getJsonFieldNames();
            $fields = array_merge($fields, $relatedJson);
        }

        //consider reverse relations
        $relations = $this->schema->getReverseRelations();
        foreach ($relations as $joinTable => $relation) {
            //deal with post_post at a later time
            if ($relation['source']['name'] === $relation['name']) {
                continue;
            }

            //if filter primary is not set
            if (!isset($filter[$relation['primary1']])
                && !isset($in[$relation['primary1']])
            ) {
                continue;
            }

            $search
                ->innerJoinUsing(
                    $joinTable,
                    $relation['primary2']
                )
                ->innerJoinUsing(
                    $relation['source']['name'],
                    $relation['primary1']
                );

            $relatedJson = Schema::i($relation['source']['name'])->getJsonFieldNames();
            $fields = array_merge($fields, $relatedJson);
        }

        //now deal with post_post
        $circular = $this->schema->getRelations($this->schema->getName());
        //if there is a post_post and they are trying to filter by it
        if (!empty($circular) && isset($filter[$circular['primary']])) {
            //they mean to filter by the parent
            $filter[$circular['primary1']] = $filter[$circular['primary']];

            //remove the old
            unset($filter[$circular['primary']]);

            //now add the join
            $search->innerJoinOn(
                $circular['table'],
                sprintf(
                    '%s = %s',
                    $circular['primary'],
                    $circular['primary2']
                )
            );
        }

        //add filters
        foreach ($filter as $column => $value) {
            if (preg_match('/^[a-zA-Z0-9-_]+$/', $column)) {
                $search->addFilter($column . ' = %s', $value);
                continue;
            }

            //by chance is it a json filter?
            if (preg_match('/^[a-zA-Z0-9-_\.]+$/', $column)) {
                $name = substr($column, 0, strpos($column, '.'));
                $path = substr($column, strpos($column, '.'));
                $path = preg_replace('/\.*([0-9]+)/', '[$1]', $path);

                //it should be a json column type
                if (!in_array($name, $this->schema->getJsonFieldNames())) {
                    continue;
                }

                $column = sprintf('JSON_EXTRACT(%s, "$%s")', $name, $path);

                $search->addFilter($column . ' = %s', $value);
                continue;
            }
        }

        //add like filters
        foreach ($like as $column => $value) {
            if (preg_match('/^[a-zA-Z0-9-_]+$/', $column)) {
                $search->addFilter($column . ' LIKE %s', '%' . $value . '%');
                continue;
            }

            //by chance is it a json filter?
            if (preg_match('/^[a-zA-Z0-9-_\.]+$/', $column)) {
                $name = substr($column, 0, strpos($column, '.'));
                $path = substr($column, strpos($column, '.'));
                $path = preg_replace('/\.*([0-9]+)/', '[$1]', $path);

                 //it should be a json column type
                if (!in_array($name, $this->schema->getJsonFieldNames())) {
                    continue;
                }

                $column = sprintf('JSON_EXTRACT(%s, "$%s")', $name, $path);
                $search->addFilter($column . ' = %s', $value);
                continue;
            }
        }

        // add in filters
        foreach ($in as $column => $values) {
            // values should be array
            if (!is_array($values)) {
                $values = [$values];
            }

            //if it's a json column type
            if (in_array($column, $this->schema->getJsonFieldNames())) {
                $or = [];
                $where = [];
                foreach ($values as $value) {
                    $where[] = "JSON_SEARCH(LOWER($column), 'one', %s) IS NOT NULL";
                    $or[] = '%' . strtolower($value) . '%';
                }

                array_unshift($or, '(' . implode(' OR ', $where) . ')');
                call_user_func([$search, 'addFilter'], ...$or);

                continue;
            }

            if (preg_match('/^[a-zA-Z0-9-_]+$/', $column)) {
                $search->addFilter($column . ' IN ("' . implode('", "', $values) . '")');
            }
        }

        //Legacy TODO: remove
        // add json filters
        foreach ($json as $column => $values) {
            //it should be a json column type
            if (!in_array($column, $this->schema->getJsonFieldNames())) {
                continue;
            }

            // values should be array
            if (!is_array($values)) {
                $values = [$values];
            }

            $or = [];
            $where = [];
            foreach ($values as $value) {
                $where[] = "JSON_SEARCH(LOWER($column), 'one', %s) IS NOT NULL";
                $or[] = '%' . strtolower($value) . '%';
            }

            array_unshift($or, '(' . implode(' OR ', $where) . ')');
            call_user_func([$search, 'addFilter'], ...$or);
        }

        //add spans
        foreach ($span as $column => $value) {
            if (!empty($value)) {
                if (!preg_match('/^[a-zA-Z0-9-_]+$/', $column)) {
                    continue;
                }

                // minimum?
                if (isset($value[0]) && !empty($value[0])) {
                    $search
                        ->addFilter($column . ' >= %s', $value[0]);
                }

                // maximum?
                if (isset($value[1]) && !empty($value[1])) {
                    $search
                        ->addFilter($column . ' <= %s', $value[1]);
                }
            }
        }

        //keyword?
        if (!empty($searchable)) {
            $keywords = [];

            if (isset($data['q'])) {
                $keywords = $data['q'];

                if (!is_array($keywords)) {
                    $keywords = [$keywords];
                }
            }

            foreach ($keywords as $keyword) {
                $or = [];
                $where = [];
                foreach ($searchable as $name) {
                    $where[] = 'LOWER(' . $name . ') LIKE %s';
                    $or[] = '%' . strtolower($keyword) . '%';
                }

                array_unshift($or, '(' . implode(' OR ', $where) . ')');
                call_user_func([$search, 'addFilter'], ...$or);
            }
        }

        //add sorting
        foreach ($order as $sort => $direction) {
            if (preg_match('/^[a-zA-Z0-9-_]+$/', $sort)) {
                $search->addSort($sort, $direction);
                continue;
            }

            //by chance is it a json filter?
            if (preg_match('/^[a-zA-Z0-9-_\.]+$/', $sort)) {
                $name = substr($sort, 0, strpos($sort, '.'));
                $path = substr($sort, strpos($sort, '.'));
                $path = preg_replace('/\.*([0-9]+)/', '[$1]', $path);

                //it should be a json column type
                if (!in_array($name, $this->schema->getJsonFieldNames())) {
                    continue;
                }

                $column = sprintf('JSON_EXTRACT(%s, "$%s")', $name, $path);
                $search->addSort($column, $direction);
                continue;
            }
        }

        $rows = $search->getRows();

        foreach ($rows as $i => $results) {
            foreach ($fields as $field) {
                if (isset($results[$field]) && $results[$field]) {
                    $rows[$i][$field] = json_decode($results[$field], true);
                } else {
                    $rows[$i][$field] = [];
                }
            }

            //custom formats & formulas
            foreach($this->schema->getFields() as $field) {
                if($field['detail']['format'] === 'formula') {
                    $helper = cradle('global')
                        ->handlebars()
                        ->getHelper('formula');

                    $rows[$i][$field['name']] = $helper(
                        $field['detail']['parameters'],
                        $results,
                        false
                    );

                    continue;
                }

                if($field['detail']['format'] === 'custom') {
                    $helper = cradle('global')
                        ->handlebars()
                        ->getHelper('compile');

                    $rows[$i][$field['name']] = $helper(
                        $field['detail']['parameters'],
                        $results
                    );

                    continue;
                }
            }
        }

        //return response format
        $response =  [
            'rows' => $rows,
            'total' => $search->getTotal()
        ];

        if ($sum) {
            $total = $search
                ->setColumns($sum)
                ->getRow();

            $response['sum_field'] = $total['total'] ? $total['total'] : 0;
        }

        return $response;
    }
970680
public function init()
    {
        if ($this->countRows < 1) {
            $this->totalPages = 0;
            $this->currentPage = 0;

            return;
        }

        if ($this->limit < 10) {
            $this->limit = 10;
        }

        $this->totalPages = (int)($this->countRows / $this->limit);

        if ($this->countRows % $this->limit) {
            $this->totalPages++;
        }

        if ($this->totalPages === 0) {
            $this->totalPages = 1;
        }

        if ($this->currentPage < 0) {
            $this->currentPage = 0;
        }

        if ($this->currentPage > $this->totalPages) {
            $this->currentPage = $this->totalPages;
        }
    }
1183651
public function Bind()
	{
		$this->getAbstractNode(0)->Bind();
		/**
		 * @var QName $qname
		 */
		$qname = $this->getQNVarName();
		$this->_varRef = $this->getContext()->RunningContext->NameBinder->PushVar( $qname );
		$this->getAbstractNode(1)->Bind();
		$this->getContext()->RunningContext->NameBinder->PopVar();
	}
662223
public function setContext(array $context)
    {
        $this->clearContext();
        foreach ($context as $key => $value) {
            $this->setContextValue($key, $value);
        }
    }
18593
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var SyliusPaymentInterface $payment */
        $payment = $request->getModel();

        /** @var OrderInterface $order */
        $order = $payment->getOrder();

        $this->gateway->execute($status = new GetStatus($payment));
        if ($status->isNew()) {
            try {
                $this->gateway->execute($convert = new Convert($payment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            } catch (RequestNotSupportedException $e) {
                $totalAmount = $order->getTotal();
                $payumPayment = new PayumPayment();
                $payumPayment->setNumber($order->getNumber());
                $payumPayment->setTotalAmount($totalAmount);
                $payumPayment->setCurrencyCode($order->getCurrencyCode());
                $payumPayment->setClientEmail($order->getCustomer()->getEmail());
                $payumPayment->setClientId($order->getCustomer()->getId());
                $payumPayment->setDescription($this->paymentDescriptionProvider->getPaymentDescription($payment));
                $payumPayment->setDetails($payment->getDetails());

                $this->gateway->execute($convert = new Convert($payumPayment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            }
        }

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        try {
            $request->setModel($details);
            $this->gateway->execute($request);
        } finally {
            $payment->setDetails((array) $details);
        }
    }
600982
public function execute()
    {
        foreach (array_unique($this->bootstrappers->all()) as $class) {
            $bootstrapper = $this->create($class);

            if (!method_exists($bootstrapper, 'run')) {
                throw new \RuntimeException("$class must have run() method");
            }

            $bootstrapper->run();
        }
    }
654527
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getSource();
        /** @var OrderInterface $order */
        $order = $payment->getOrder();

        $details = [];
        $details['PAYMENTREQUEST_0_INVNUM'] = $this->invoiceNumberGenerator->generate($order, $payment);
        $details['PAYMENTREQUEST_0_CURRENCYCODE'] = $order->getCurrencyCode();
        $details['PAYMENTREQUEST_0_AMT'] = $this->formatPrice($order->getTotal());
        $details['PAYMENTREQUEST_0_ITEMAMT'] = $this->formatPrice($order->getTotal());

        $m = 0;
        foreach ($order->getItems() as $item) {
            $details['L_PAYMENTREQUEST_0_NAME' . $m] = $item->getVariant()->getProduct()->getName();
            $details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($item->getDiscountedUnitPrice());
            $details['L_PAYMENTREQUEST_0_QTY' . $m] = $item->getQuantity();

            ++$m;
        }

        if (0 !== $taxTotal = $order->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)) {
            $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Tax Total';
            $details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($taxTotal);
            $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;

            ++$m;
        }

        if (0 !== $promotionTotal = $order->getOrderPromotionTotal()) {
            $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Discount';
            $details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($promotionTotal);
            $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;

            ++$m;
        }

        if (0 !== $shippingTotal = $order->getShippingTotal()) {
            $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Shipping Total';
            $details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($shippingTotal);
            $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
        }

        $request->setResult($details);
    }
585224
public function setDefault($key, $value)
    {
        if ($this->saveDefaults) {
            if (! $this->exists($key)) {
                $this->set($key, $value);
            } elseif (is_array($value)) {
                $this[$key]->defaults = $value;
            }
        } else {
            if (! isset($this->defaultData[$key])) {
                $this->defaultData[$key] = $value;
            } elseif (is_array($value)) {
                $this[$key]->defaults = $value;
            }
        }
    }
138484
public function compile(CompilerInterface $compiler)
    {
        $i = 0;

        foreach ($this->getChildren() as $c) {
            $c->compile($compiler);

            ++$i;

            if ($i < count($this->getChildren())) {
                $compiler->write(', ');
            }
        }
    }
1016771
public function setMethod($method = null)
    {
        if ($method === null) {
            $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
        }

        $this->method = $method;
    }
898114
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getModel();

        if (in_array($payment->getState(), array(PaymentInterface::STATE_APPROVED, PaymentInterface::STATE_DEPOSITED))) {
            $request->markCaptured();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_DEPOSITING))) {
            $request->markPending();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_CANCELED))) {
            $request->markCanceled();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_EXPIRED))) {
            $request->markExpired();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_FAILED))) {
            $request->markFailed();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_NEW, PaymentInterface::STATE_APPROVING))) {
            $request->markNew();

            return;
        }

        $request->markUnknown();
    }
914833
public function update()
    {
        $snapshot = $this->_snapshot;
        if ($snapshot === false) {
            throw new PreconditionException(['update failed: `:model` instance is snapshot disabled', 'model' => static::class]);
        }

        $primaryKeyValuePairs = $this->_getPrimaryKeyValuePairs();

        $fields = $this->getFields();

        $changedFields = [];
        foreach ($fields as $field) {
            if ($this->$field === null) {
                /** @noinspection NotOptimalIfConditionsInspection */
                if (isset($snapshot[$field])) {
                    $changedFields[] = $field;
                }
            } elseif (!isset($snapshot[$field])) {
                $changedFields[] = $field;
            } elseif ($snapshot[$field] !== $this->$field) {
                if (is_string($this->$field) && !is_string($snapshot[$field]) && (string)$snapshot[$field] === $this->$field) {
                    $this->$field = $snapshot[$field];
                } else {
                    $changedFields[] = $field;
                }
            }
        }

        if (!$changedFields) {
            return $this;
        }

        $this->validate($changedFields);

        foreach ($this->getAutoFilledData(self::OP_UPDATE) as $field => $value) {
            if (in_array($field, $fields, true)) {
                $this->$field = $value;
            }
        }

        $this->eventsManager->fireEvent('model:beforeSave', $this);
        $this->eventsManager->fireEvent('model:beforeUpdate', $this);

        $fieldValues = [];
        foreach ($fields as $field) {
            if ($this->$field === null) {
                if (isset($snapshot[$field])) {
                    $fieldValues[$field] = null;
                }
            } elseif (!isset($snapshot[$field]) || $snapshot[$field] !== $this->$field) {
                $fieldValues[$field] = $this->$field;
            }
        }

        foreach ($primaryKeyValuePairs as $key => $value) {
            unset($fieldValues[$key]);
        }

        if (!$fieldValues) {
            return $this;
        }

        foreach ($this->getJsonFields() as $field) {
            if (isset($fieldValues[$field]) && is_array($fieldValues[$field])) {
                $fieldValues[$field] = json_encode($fieldValues[$field], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            }
        }

        $query = static::query(null, $this)->where($primaryKeyValuePairs);
        $query->update($fieldValues);

        $expressionFields = [];
        foreach ($fieldValues as $field => $value) {
            if ($value instanceof ExpressionInterface) {
                $expressionFields[] = $field;
            }
        }

        if ($expressionFields && $rs = $query->select($expressionFields)->fetch(true)) {
            foreach ((array)$rs[0] as $field => $value) {
                $this->$field = $value;
            }
        }

        $this->_snapshot = $this->toArray();

        $this->eventsManager->fireEvent('model:afterUpdate', $this);
        $this->eventsManager->fireEvent('model:afterSave', $this);

        return $this;
    }
1071971
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $request->setResult([
            Constants::FIELD_PAID => false,
        ]);
    }