Finds the post parameters
@param \stdClass      $postParams
@param ModelInterface $entity
@return \stdClass
979261
private function findPostParams(\stdClass $postParams, ModelInterface $entity) {
        //Entity is passed in so children can access it
        $dataTransformer = $this->getDataTransformer($postParams);
        if(!is_null($dataTransformer)) {
            $dataTransformer->transform($entity);
            $postParams = $dataTransformer->getParams();
        }
        return $postParams;
    }
199058
public function update(EntityInterface $entity)
	{
		$sql = <<<EOT
UPDATE `$this->tableName` 
SET 
	`Name` = :name , 
	`Description` = :description , 
	`Created` = :created  
WHERE `ProjectId` = :id 
EOT;

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':id', $entity->getProjectId(), \PDO::PARAM_INT);
		$stmt->bindParam(':name', $entity->getName(), \PDO::PARAM_STR);
		$stmt->bindParam(':description', $entity->getDescription(), \PDO::PARAM_STR);
		$stmt->bindParam(':created', $entity->getCreatedRfc3339(), \PDO::PARAM_STR);
		$res = $stmt->execute();

		if ($res === false || $stmt->rowCount() !== 1) {
			return false;
		}

		return $entity;
	}
796901
public function insert(EntityInterface $entity)
	{
		$projectId = $entity->getProjectId();
		$name = $entity->getName();
		$desc = $entity->getDescription();
		$tags = $entity->getTags();
		$started = $entity->getStarted();
		$startedObj = is_null($started) ? new \DateTime() : $started;
		$startedStr = $startedObj->format(\DateTime::RFC3339);
		$stopped = $entity->getStopped();
		$stoppedObj = is_null($stopped) ? null : (($stopped instanceof \DateTime) ? $stopped : new \DateTime($stopped));
		$stoppedStr = ($stopped instanceof \DateTime) ? $stoppedObj->format(\DateTime::RFC3339) : '';

		$table = self::TABLE_NAME;
		$stmt = $this->pdo->prepare(<<<EOT
INSERT INTO `$this->tableName` (ProjectId, Name, Description, Tags, Started, Stopped) 
VALUES ( :projectId, :name , :desc , :tags , :started , :stopped );
EOT
		);
		$stmt->bindParam(':projectId', $projectId, \PDO::PARAM_INT);
		$stmt->bindParam(':name', $name, \PDO::PARAM_STR);
		$stmt->bindParam(':desc', $desc, \PDO::PARAM_STR);
		$stmt->bindParam(':tags', $tags, \PDO::PARAM_STR);
		$stmt->bindParam(':started', $startedStr, \PDO::PARAM_STR);
		$stmt->bindParam(':stopped', $stoppedStr);
		$res = $stmt->execute();

		if ($res === false || $stmt->rowCount() !== 1) {
			return false;
		}

		return $this->prepareEntity(array(
			'ActivityId' => $this->pdo->lastInsertId(),
			'ProjectId' => $projectId,
			'Name' => $name,
			'Description' => empty($description) ? null : $description,
			'Tags' => empty($tags) ? null : $tags,
			'Started' => $started,
			'Stopped' => $stopped
		));
	}
379026
public function post(EntityInterface $entity)
    {
        $pk = (string)TableRegistry::get($entity->source())->primaryKey();
        if (empty($this->_controller->request->data['comment']) ||
            $this->config('settings.visibility') !== 1 ||
            !$entity->has($pk)
        ) {
            return false;
        }

        $this->_controller->loadModel('Comment.Comments');
        $data = $this->_getRequestData($entity);
        $this->_controller->Comments->validator('commentValidation', $this->_createValidator());
        $comment = $this->_controller->Comments->newEntity($data, ['validate' => 'commentValidation']);
        $errors = $comment->errors();
        $errors = !empty($errors);

        if (!$errors) {
            $persist = true;
            $saved = true;
            $this->_controller->Comments->addBehavior('Tree', [
                'scope' => [
                    'entity_id' => $data['entity_id'],
                    'table_alias' => $data['table_alias'],
                ]
            ]);

            if ($this->config('settings.use_akismet')) {
                $newStatus = $this->_akismetStatus($data);
                $comment->set('status', $newStatus);

                if ($newStatus == 'spam' &&
                    $this->config('settings.akismet_action') != 'mark'
                ) {
                    $persist = false;
                }
            }

            if ($persist) {
                $saved = $this->_controller->Comments->save($comment);
            }

            if ($saved) {
                $this->_afterSave($comment);

                return true; // all OK
            } else {
                $errors = true;
            }
        }

        if ($errors) {
            $this->_setErrors($comment);
            $errorMessage = $this->config('errorMessage');
            if (is_callable($errorMessage)) {
                $errorMessage = $errorMessage($comment, $this->_controller);
            }
            $this->_controller->Flash->danger($errorMessage, ['key' => 'commentsForm']);
        }

        return false;
    }
592490
public static function getQueryPostMerge($getParams, SearchInterface $className)
	{
		$postParams = Yii::$app->request->getBodyParams();
		foreach ($getParams as $key => $getParam) {
			if (empty($getParam)) {
				unset($getParams[$key]);
			}
		}
		$params = array_merge($postParams, $getParams);

		foreach ($params as $key => $value) {
			if (!in_array($key, $className::affordVariables())) {
				throw new BadRequestHttpException('Переданы недопустимые параметры');
			}
		}
		$query = self::getQueryFromRequest($params);
		unset($params['expand']);
		$query->whereFromCondition($params);
		return $query;
	}
1020025
public function get_from_post_id(int $id) : ?forum_entity {
        $alias = $this->get_table_alias();
        $thistable = new dml_table(self::TABLE, $alias, $alias);
        $coursemoduletable = new dml_table('course_modules', 'cm', 'cm_');
        $coursetable = new dml_table('course', 'c', 'c_');

        $tablefields = $thistable->get_field_select();
        $coursemodulefields = $coursemoduletable->get_field_select();
        $coursefields = $coursetable->get_field_select();

        $fields = implode(', ', [
            $tablefields,
            context_helper::get_preload_record_columns_sql('ctx'),
            $coursemodulefields,
            $coursefields,
        ]);

        $tables = "{forum_posts} p";
        $tables .= " JOIN {forum_discussions} d ON d.id = p.discussion";
        $tables .= ' JOIN {' . self::TABLE . "} {$alias} ON {$alias}.id = d.forum";
        $tables .= " JOIN {modules} m ON m.name = 'forum'";
        $tables .= " JOIN {course_modules} cm ON cm.module = m.id AND cm.instance = {$alias}.id";
        $tables .= ' JOIN {context} ctx ON ctx.contextlevel = ' . CONTEXT_MODULE .  ' AND ctx.instanceid = cm.id';
        $tables .= " JOIN {course} c ON c.id = {$alias}.course";

        $sql = "SELECT {$fields} FROM {$tables} WHERE p.id = :postid";
        $records = $this->get_db()->get_records_sql($sql, [
            'postid' => $id,
        ]);

        $records = $this->transform_db_records_to_entities($records);
        return count($records) ? array_shift($records) : null;
    }
1069765
public function findBy(
        string $modelClass,
        array $criteria,
        array $orderBy = null,
        int $limit = null,
        int $offset = null
    ): array {
        return $this->getRepositoryByClass($modelClass)->findBy($criteria, $orderBy, $limit, $offset);
    }
559558
public function getFromEntity($entity, array $formParameters, $limitFields = null)
    {
        $extracted_data = array();

        foreach($formParameters as $field) {
            $getter_name = "get".$this->dashesToCamelCase($field);

            if (($limitFields === null || in_array($field, $limitFields)) && method_exists($entity, $getter_name) && ($value = $entity->$getter_name()) !== null) {
                $extracted_data[$field] = $value;
            }
        }

        return $extracted_data;
    }
292537
protected function formatKeyCondition(EntityInterface $entity)
    {
        $attributes = array(
            $entity::getHashKeyAttribute() => $entity->getHashKey(),
        );

        $rangeKeyAttribute = $entity::getRangeKeyAttribute();
        if ($rangeKeyAttribute !== false) {
            $attributes[$rangeKeyAttribute] = $entity->getRangeKey();
        }

        return $this->formatAttributes(get_class($entity), $attributes);
    }
490999
public function get_view_post_url_from_post(post_entity $post) : moodle_url {
        return $this->get_view_post_url_from_post_id($post->get_discussion_id(), $post->get_id());
    }
343187
public function ezodfGetChildren( $getParams, $getOptions, $postParams, $postOptions )
    {
        $nodeID = $getParams['nodeID'];
        $languageCode = $getOptions['languageCode'];
        $offset = $getOptions['offset'];
        $limit = $getOptions['limit'];

        $domDocument = new DOMDocument( '1.0', 'utf-8' );
        $childrenElement = $domDocument->createElement( 'Children' );

        // Set attributes.
        $childrenElement->setAttribute( 'offset', $offset );
        if ( $languageCode )
        {
            $childrenElement->setAttribute( 'languageCode', $languageCode );
        }
        $childrenElement->setAttribute( 'limit', $limit );

        // Get children, and add them to children list.
        $children = eZContentObjectTreeNode::subTreeByNodeID( array( 'Depth' => 1,
                                                                     'DepthOperator' => 'eq',
                                                                     'Limit' => $limit,
                                                                     'Offset' => $offset,
                                                                     'Language' => $languageCode ),
                                                              $nodeID );
        if ( $children )
        {
            foreach( $children as $childNode )
            {
                $childrenElement->appendChild( $this->createTreeNodeDOMElement( $domDocument, $childNode ) );
            }
            $childrenElement->setAttribute( 'count', count( $children ) );
        }
        else
        {
            $childrenElement->setAttribute( 'count', count( $children ) );
        }

        return $childrenElement;
    }
351224
public function find(string $modelClass, string $id = null)
    {
        if (null === $id) {
            return null;
        }

        return $this->getRepositoryByClass($modelClass)->find($id);
    }
896247
public function getEntityPostfixByInterfaceName($entityInterfaceName)
    {
        if (false === $this->hasEntityPostfixByInterfaceName($entityInterfaceName)) {
            $errMsg = sprintf('Error build entity postfix for %s', $entityInterfaceName);
            throw new Exception\ErrorBuildEntityPostfixException($errMsg);
        }

        return $this->interfaceNameToEntityPostfix[$entityInterfaceName];
    }
512798
public function postParametersToCurl(array $postParameters)
    {
        $this->formatedParameters = [];
        $curlPostParameters       = '--data "';

        foreach ($this->formatParameters($postParameters) as $key => $value) {
            $curlPostParameters .= sprintf('%s=%s&', $key, $value);
        }

        return substr($curlPostParameters, 0, -1).'"';
    }
1250780
public Map<String, String> getUriVariablesForQueryWithPost(BullhornEntityInfo entityInfo, Set<String> fieldSet, QueryParams params) {

        Map<String, String> uriVariables = params.getParameterMap();

        this.addCommonUriVariables(fieldSet, entityInfo, uriVariables);

        return uriVariables;
    }
355179
protected function getConditions(EntityInterface $entity)
    {
        $field = "{$this->getParentTableName()}.{$this->getForeignKey()}";
        $property = $this->getPropertyName();
        $conditions = [
            "{$field} = :{$property}" => [
                ":{$property}" => $entity->getId()
            ]
        ];
        return $conditions;
    }
561088
public function update(EntityInterface $entity)
	{
		$sql = <<<EOT
UPDATE `$this->tableName` 
SET 
	`ProjectId` = :projectId , 
	`Name` = :name , 
	`Description` = :description , 
	`Tags` = :tags , 
	`Started` = :started , 
	`Stopped` = :stopped 
WHERE `ActivityId` = :id 
EOT;

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':id', $entity->getActivityId(), \PDO::PARAM_INT);
		$stmt->bindParam(':projectId', $entity->getProjectId(), \PDO::PARAM_INT);
		$stmt->bindParam(':name', $entity->getName(), \PDO::PARAM_STR);
		$stmt->bindParam(':description', $entity->getDescription(), \PDO::PARAM_STR);
		$stmt->bindParam(':tags', $entity->getTags(), \PDO::PARAM_STR);
		$stmt->bindParam(':started', $entity->getStartedRfc3339(), \PDO::PARAM_STR);
		$stmt->bindParam(':stopped', $entity->getStoppedRfc3339(), \PDO::PARAM_STR);
		$res = $stmt->execute();

		if ($res === false || $stmt->rowCount() !== 1) {
			return false;
		}

		return $entity;
	}