Sets a property on the Community.

@param array $postData
@return object
166079
private function set(array $postData)
    {
        return $this->putJson(sprintf(self::COMMUNITY_ENDPOINT . 'communities/%s', $this->id()), $postData);
    }
470917
protected function setPrimaryKey($modelData)
    {
        $primaryKey = '// Using default primary key' . PHP_EOL;

        foreach ($modelData->fields as $field)
        {
            if ($field->index == 'primary')
            {
                $primaryKey = 'protected $primaryKey = \'' . $field->name . '\';' . PHP_EOL;
                break;
            }
        }

        $this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);

        return $this;
    }
1183989
func (a *ContinueInterceptedRequestArgs) SetPostData(postData string) *ContinueInterceptedRequestArgs {
	a.PostData = &postData
	return a
}
134384
protected function setParsedData($parsedData): Payload
    {
        $data = json_decode($parsedData);
        if (JSON_ERROR_NONE === json_last_error()) {
            $this->parsedData = $data;
        }

        return $this;
    }
64155
public function setDataPost($dataPost) {
        if (!is_array($dataPost) || empty($dataPost)) {
            $this->dataPost = array();
        }

        $this->dataPost = $dataPost;
    }
1342402
public function mapToObject(array $objectData)
    {
        if ($objectData === []) {
            throw new Exception\InvalidObjectDataException('The array with object data was empty, probably object not found or access denied.', 1277974338);
        }

        if ($this->persistenceSession->hasIdentifier($objectData['identifier'])) {
            return $this->persistenceSession->getObjectByIdentifier($objectData['identifier']);
        } else {
            $className = $objectData['classname'];
            $classSchema = $this->reflectionService->getClassSchema($className);

            $object = unserialize('O:' . strlen($className) . ':"' . $className . '":0:{};');
            $this->persistenceSession->registerObject($object, $objectData['identifier']);
            if ($classSchema->getModelType() === ClassSchema::MODELTYPE_ENTITY) {
                $this->persistenceSession->registerReconstitutedEntity($object, $objectData);
            }
            if ($objectData['properties'] === []) {
                if (!$classSchema->isLazyLoadableObject()) {
                    throw new PersistenceException('The object of type "' . $className . '" is not marked as lazy loadable.', 1268309017);
                }
                $persistenceManager = $this->persistenceManager;
                $persistenceSession = $this->persistenceSession;
                $dataMapper = $this;
                $identifier = $objectData['identifier'];
                $modelType = $classSchema->getModelType();
                $object->Flow_Persistence_LazyLoadingObject_thawProperties = function ($object) use ($persistenceManager, $persistenceSession, $dataMapper, $identifier, $modelType) {
                    $objectData = $persistenceManager->getObjectDataByIdentifier($identifier);
                    $dataMapper->thawProperties($object, $identifier, $objectData);
                    if ($modelType === ClassSchema::MODELTYPE_ENTITY) {
                        $persistenceSession->registerReconstitutedEntity($object, $objectData);
                    }
                };
            } else {
                $this->thawProperties($object, $objectData['identifier'], $objectData);
            }

            return $object;
        }
    }
270922
public static function allowContentItem($postdata=false) {
        if ( ! $postdata ) $postdata = LTIX::ltiRawPostArray();
        return parent::allowContentItem($postdata);
    }
1059422
public function setData($modelData)
    {
        if ($this->config->getInheritData()) {
            throw new RuntimeException('You cannot change the data of a block inheriting its parent data.');
        }

        if ($this->lockSetData) {
            throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call setData(). You should call setData() on the BlockEvent object instead.');
        }

        if (null !== $this->getForm() && null === $this->getForm()->getData()) {
            $this->getForm()->setData($modelData);
        }

        $this->lockSetData = true;
        $dispatcher = $this->config->getEventDispatcher();

        // Hook to change content of the data
        if ($dispatcher->hasListeners(BlockEvents::PRE_SET_DATA)) {
            $event = new BlockEvent($this, $modelData);
            $dispatcher->dispatch(BlockEvents::PRE_SET_DATA, $event);
            $modelData = $event->getData();
        }

        if (BlockUtil::isEmpty($modelData)) {
            $emptyData = $this->config->getEmptyData();

            if ($emptyData instanceof \Closure) {
                /* @var \Closure $emptyData */
                $emptyData = $emptyData($this, $modelData, $this->getOptions());
            }

            $modelData = $emptyData;
        }

        // Treat data as strings unless a value transformer exists
        if (!$this->config->getViewTransformers() && !$this->config->getModelTransformers() && is_scalar($modelData) && !\is_bool($modelData)) {
            $modelData = (string) $modelData;
        }

        // Synchronize representations - must not change the content!
        $normData = $this->modelToNorm($modelData);
        $viewData = $this->normToView($normData);

        // Validate if view data matches data class (unless empty)
        if (!BlockUtil::isEmpty($viewData)) {
            $dataClass = $this->getDataClass();

            $actualType = \is_object($viewData) ? 'an instance of class '.\get_class($viewData) : ' a(n) '.\gettype($viewData);

            if (null === $dataClass && \is_object($viewData) && !$viewData instanceof \ArrayAccess) {
                $expectedType = 'scalar, array or an instance of \ArrayAccess';

                throw new LogicException(
                        'The block\'s view data is expected to be of type '.$expectedType.', '.
                        'but is '.$actualType.'. You '.
                        'can avoid this error by setting the "data_class" option to '.
                        '"'.\get_class($viewData).'" or by adding a view transformer '.
                        'that transforms '.$actualType.' to '.$expectedType.'.'
                );
            }

            if (null !== $dataClass && !$viewData instanceof $dataClass) {
                throw new LogicException(
                        'The block\'s view data is expected to be an instance of class '.
                        $dataClass.', but is '.$actualType.'. You can avoid this error '.
                        'by setting the "data_class" option to null or by adding a view '.
                        'transformer that transforms '.$actualType.' to an instance of '.
                        $dataClass.'.'
                );
            }
        } else {
            $viewData = (string) $this->config->getEmptyMessage();
        }

        $this->modelData = $modelData;
        $this->normData = $normData;
        $this->viewData = $viewData;
        $this->defaultDataSet = true;
        $this->lockSetData = false;

        if (\count($this->children) > 0) {
            $childrenIterator = new InheritDataAwareIterator($this->children);
            $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
            $this->config->getDataMapper()->mapDataToViews($viewData, $childrenIterator);
        }

        if ($dispatcher->hasListeners(BlockEvents::POST_SET_DATA)) {
            $event = new BlockEvent($this, $modelData);
            $dispatcher->dispatch(BlockEvents::POST_SET_DATA, $event);
        }

        return $this;
    }
1100997
public static function allowContentItem($postdata) {
        if ( ! isset($postdata['content_item_return_url']) ) return false;
        if ( isset($postdata['accept_media_types']) ) {
            $web_mimetype = 'text/html';
            $m = new Mimeparse;
            $web_allowed = $m->best_match(array($web_mimetype), $postdata['accept_media_types']);
            if ( $web_mimetype != $web_allowed ) return false;
            return true;
        }
        return false;
    }
22900
public function setImage(string $imageData) : void
    {
        $url = $this->uploadImage('communityProfileImage', $imageData);

        $this->set([
            'profileImage' => [
                'sourceUrl' => $url
            ]
        ]);
    }
407043
private function setPostData($data = null)
    {
        if (null === $data) {
            curl_setopt($this->curl, CURLOPT_POST, false);

            return;
        }
        $postData = '';
        foreach ($data as $key => $value) {
            $postData .= urlencode($key) . '=' . urlencode($value) . '&';
        }
        if ($postData != '') {
            curl_setopt($this->curl, CURLOPT_POST, true);
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, substr($postData, 0, -1));
        }
    }
146961
public function setLastPost(Post $post)
    {
        $this->last_posted_at = $post->created_at;
        $this->last_posted_user_id = $post->user_id;
        $this->last_post_id = $post->id;
        $this->last_post_number = $post->number;

        return $this;
    }
555268
public function setData(array $data)
    {
        if (isset($data['attachables'])) {
            $this->setAttachables($data['attachables']);
        }

        if (isset($data['groups'])) {
            $this->setGroups($data['groups']);
        }

        if (isset($data['widgets'])) {
            $this->setWidgets($data['widgets']);
        }

        unset($data['attachables'], $data['groups'], $data['widgets']);

        return parent::setData($data);
    }
848696
protected function _update($postdata, $primary)
    {
        if (!$postdata)
        {
            self::error('$postdata array is empty');
        }
        $res = false;
        $set = array();
        $db = Fruit_db::get_instance($this->connection);
        $fields = array_merge($this->fields, $this->hidden_fields);
        foreach ($postdata as $key => $val)
        {
            if (isset($fields[$key]) && !isset($this->locked_fields[$key]) && !isset($this->custom_fields[$key]))
            {
                if (isset($this->field_type[$key]))
                {
                    switch ($this->field_type[$key])
                    {
                        case 'password':
                            if (trim($val) == '')
                            {
                                continue 2;
                            }
                            elseif ($this->defaults[$key])
                            {
                                $val = hash($this->defaults[$key], $val);
                            }
                            break;
                        case 'fk_relation': //
                            continue 2;
                            break;
                    }
                }
                /*
                if (is_array($val))
                {
                $set[] = '`' . $fields[$key]['table'] . '`.`' . $fields[$key]['field'] . '` = ' . $db->escape(implode(',', $val), false,
                $this->field_type[$key], $this->field_null[$key], isset($this->bit_field[$key]));
                }
                elseif (isset($this->point_field[$key]) && trim($val))
                {
                $set[] = '`' . $fields[$key]['table'] . '`.`' . $fields[$key]['field'] . '` = Point(' . $db->escape($val, true, 'point',
                $this->field_null[$key], isset($this->bit_field[$key])) . ')';
                }
                else
                $set[] = '`' . $fields[$key]['table'] . '`.`' . $fields[$key]['field'] . '` = ' . ((isset($this->no_quotes[$key]) &&
                isset($this->pass_var['edit'][$key])) ? $db->escape($val, true) : $db->escape(trim($val), false, $this->field_type[$key],
                $this->field_null[$key], isset($this->bit_field[$key])));
                */
                $set[] = '`' . $fields[$key]['table'] . '`.`' . $fields[$key]['field'] . '` = ' . $this->prepare_query_field($val, $key,
                    'edit');
            }
        }
        if (!$set)
        {
            self::error('Nothing to update');
        }
        if (!$this->join)
        {
            if (!$this->demo_mode)
                $res = $db->query("UPDATE `{$this->table}` SET " . implode(",\r\n", $set) . " WHERE `{$this->primary_key}` = " . $db->
                    escape($primary) . " LIMIT 1");
        }
        else
        {
            //$tables = array('`' . $this->table . '`');
            $joins = array();
            foreach ($this->join as $alias => $param)
            {
                //$tables[] = '`' . $alias . '`';
                $joins[] = "INNER JOIN `{$param['join_table']}` AS `{$alias}` 
                    ON `{$param['table']}`.`{$param['field']}` = `{$alias}`.`{$param['join_field']}`";
            }
            if (!$this->demo_mode)
                $res = $db->query("UPDATE `{$this->table}` AS `{$this->table}` " . implode(' ', $joins) . " SET " . implode(",\r\n", $set) .
                    " WHERE `{$this->table}`.`{$this->primary_key}` = " . $db->escape($primary));
        }
        if (isset($postdata[$this->table . '.' . $this->primary_key]) && $res)
            $primary = $postdata[$this->table . '.' . $this->primary_key];
        else
        {
            $postdata[$this->table . '.' . $this->primary_key] = $primary;
        }

        if ($this->fk_relation)
        {
            foreach ($this->fk_relation as $fk)
            {
                $field = $fk['table'] . '.' . $fk['field'];
                if (array_key_exists($fk['alias'], $postdata) && array_key_exists($field, $postdata))
                {
                    $in_val = $db->escape($postdata[$field], false, $this->field_type[$field], $this->field_null[$field], isset($this->
                        bit_field[$field]));
                    $db->query('DELETE FROM `' . $fk['fk_table'] . '` WHERE `' . $fk['in_fk_field'] . '` = ' . $in_val . ' AND ' . $this->
                        _build_rel_ins_where($fk['alias']));
                    $fkids = $this->parse_comma_separated($postdata[$fk['alias']]);
                    if ($fkids)
                    {
                        $ins_vals = array();
                        $ins_keys = array();
                        $ins_add = array();
                        if ($fk['add_data'])
                        {
                            foreach ($fk['add_data'] as $add_key => $add_val)
                            {
                                $ins_keys[] = '`' . $add_key . '`';
                                $ins_add[] = $db->escape($add_val);
                            }
                        }
                        $ins_add[] = /*$db->escape(*/ $in_val /*)*/;
                        $ins_keys[] = '`' . $fk['in_fk_field'] . '`';
                        $ins_keys[] = '`' . $fk['out_fk_field'] . '`';
                        foreach ($fkids as $fkid)
                        {
                            $ins_vals[] = '(' . implode(',', $ins_add) . ',' . $db->escape($fkid) . ')';
                        }
                        $db->query('INSERT INTO `' . $fk['fk_table'] . '` (' . implode(',', $ins_keys) . ') VALUES ' . implode(',', $ins_vals));
                    }
                }
            }
        }

        unset($set, $postdata);
        return $primary;
    }
1042512
public function getRequest( array $requestPostData )
    {
        $requestProperties = array(
            'username'    => $requestPostData[1],
            'password'    => $requestPostData[2],
            'title'       => $requestPostData[3]['title'],
            'description' => $requestPostData[3]['description'],
            'keywords'    => $requestPostData[3]['mt_keywords'],
            'status'      => $requestPostData[3]['post_status'],
        );

        return new Request( $requestProperties );
    }
1165120
protected function applyHttpAttributes($http, $postData)
    {
        $postData['protocol_version'] = '1.1';
        $postData['client'] = 'october';

        $postData['server'] = base64_encode(serialize([
            'php'   => PHP_VERSION,
            'url'   => Url::to('/'),
            'since' => PluginVersion::orderBy('created_at')->value('created_at')
        ]));

        if ($projectId = Parameter::get('system::project.id')) {
            $postData['project'] = $projectId;
        }

        if (Config::get('cms.edgeUpdates', false)) {
            $postData['edge'] = 1;
        }

        if ($this->key && $this->secret) {
            $postData['nonce'] = $this->createNonce();
            $http->header('Rest-Key', $this->key);
            $http->header('Rest-Sign', $this->createSignature($postData, $this->secret));
        }

        if ($credentials = Config::get('cms.updateAuth')) {
            $http->auth($credentials);
        }

        $http->noRedirect();
        $http->data($postData);
    }
1037917
public function put(array $params, array $postData) {
        $this->_requireDataType($params);
        if (!array_get($params, 'id')) {
            throw new Garp_Content_Api_Rest_Exception(
                self::EXCEPTION_PUT_WITHOUT_ID
            );
        }
        $model = $this->_normalizeModelName($params['datatype']);

        // First, see if the record actually exists
        list($record) = $this->_getSingleResult($params);
        if (is_null($record['result'])) {
            return $this->_formatResponse(array('success' => false), 404);
        }

        if (!array_get($params, 'relatedType')) {
            $this->_updateSingle($params, $postData);
            list($response, $httpCode) = $this->_getSingleResult($params);
        } else {
            $schema = new Garp_Content_Api_Rest_Schema('rest');
            // Sanity check if related model exists
            list($relatedRecord) = $this->_getSingleResult(
                array(
                    'datatype' => getProperty(
                        'model',
                        $schema->getRelation(
                            $params['datatype'],
                            $params['relatedType']
                        )
                    ),
                    'id' => $params['relatedId']
                )
            );
            if (!$relatedRecord['result']) {
                return $this->_formatResponse(array('success' => false), 404);
            }

            $this->_addRelation($params, $postData);
            list($response, $httpCode) = $this->_getRelatedResults($params);
        }
        return $this->_formatResponse($response, $httpCode);
    }