Handler::deleteFields()

@return
493121
public function deleteFields(array $fields)
    {
        $fields = Validate::arrToLower($fields);
        if (($key = array_search($this->databaseConfig->getIdentifier(), $fields)) !== false)
            throw new \Exception('You can not delete the id field');
        $diff   = array_diff($fields,$this->fields());
        if (!empty($diff))
            throw new \Exception('Field(s) "' . implode(', ', $diff) . '" does not exists in table');
        $config         = $this->getConfig();
        $config->schema = array_diff_key($this->schema(), array_flip($fields));
        $data = $this->getData();
        foreach ($data as $key => $object)
        {
            foreach ($fields as $name)
                unset($data[$key]->{$name});
        }
        $this->databaseDocument->put($data);
        $this->databaseConfig->put($config);
        return true;
    }
88492
def _delete_fields(self):
        
        for key in self._json_dict.keys():
            if not key.startswith("_"):
                delattr(self, key)
        self._json_dict = {}
        self.id = None
        self.name = None
416981
public function deleteEventMessage($fields) {
        $this->checkRequiredKeys(__METHOD__, $fields, array('SUBJECT', 'EVENT_NAME'));

        $exists = $this->getEventMessage(array(
            'EVENT_NAME' => $fields['EVENT_NAME'],
            'SUBJECT' => $fields['SUBJECT']
        ));

        if (empty($exists)) {
            return false;
        }

        if (\CEventMessage::Delete($exists['ID'])) {
            return true;
        };

        $this->throwException(__METHOD__, 'Could not delete event message %s:%s', $fields['EVENT_NAME'], $fields['SUBJECT']);
    }
1205430
public function except($fields)
    {
        $fields = (array) $fields;

        return $this->map(
            static function (Data $data) use ($fields) {
                return $data->except($fields);
            }
        );
    }
649154
public function destroy()
    {
        $table   = $this->_builder->table;
        $where   = $this->_builder->where;

        $builder = new Builder();
        $builder->prefix = "delete";
        $builder->fields = "";
        $builder->table  = $table;
        $builder->where  = $where;

        $cls = $this->_cls;
        return $cls::executePrepared($builder, $this->_vals)->rowCount()>0;
    }
1098839
public function delFieldsArray(array $fields)
	{
	        foreach ($fields as $field) {
                        $this->_redis->hdel($this->_key, $field);
                }
	}
362075
public function delete()
    {
        // Define wheres
        $where = $this->getWhereString();

        // Define where in
        $whereIn = $this->getWhereInString();

        // Build query
        $this->query = 'DELETE FROM ' . $this->table . ' '. $where . ' ' . $whereIn;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind where values
        if (count($this->wheres)) {
            $this->bindWheres();
        }

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
785320
public function removeSystemFields()
    {
        $properties = $this->fields;
        unset(
            $properties['created'],
            $properties['changed'],
            $properties['changer'],
            $properties['changer_id'],
            $properties['creator'],
            $properties['creator_id']
        );

        foreach ($properties as $key => $field) {
            // remove system fields
            if ('__' == substr($key, 0, 2)) {
                continue;
            }

            $this->properties[$key] = $field->getValue();
        }
    }
1284541
public function deleteFields($requestParams)
    {
        $requiredParams = array(
            "objectID"
        );
        return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::FIELDEDITOR, "delete", $requiredParams, $options = NULL);
    }
1202858
protected function delete()
    {
        $nodeRef = $this->buildCmsNodeRef('Slug');

        $node = $nodeRef->generateNode();

        $location = 'load';
        $this->Events->trigger('NodeCmsController.delete'.'.'.$location,
                                    $this->errors, $this->templateVars, $node);
        foreach((array)$nodeRef->getElement()->getAspects() as $aspect)
            $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'delete'.'.'.$location,
                                    $this->errors, $this->templateVars, $node);

        if (!$node->hasTitle())
            //get default form backing object
            $node = $this->RegulatedNodeService->getByNodeRef($node->getNodeRef());

        if (empty($node))
            throw new NotFoundException('Record not found for NodeRef: '.$nodeRef);

        // check permissions
        // $this->checkDeletePermission($node);

        if (!$this->buttonPushed()) {
            $this->Session->setFlashAttribute('delete_referer', $this->Request->getReferrer());
            //show delete confirmation view (action_form_view)
            return new View($this->formView());
        }

        if ($this->saveButtonPushed()) {
            $this->checkNonce();
            $mergeSlug = null;
            $tags      = isset($this->params['OutTags']['#merge'])  ?
                           $this->params['OutTags']['#merge']
                         : array();

            if (!empty($tags)) {
                $newtag = new Tag(current($tags));

                if ($newtag->TagElement != $nodeRef->getElement()->getSlug())
                    throw new Exception('Unable to merge with different element ['.$newtag->TagElement.']');

                $mergeSlug = $newtag->TagSlug;
            }

            $location = 'pre';
            $this->Events->trigger('NodeCmsController.delete'.'.'.$location,
                                    $this->errors, $this->templateVars, $node, $mergeSlug);
            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'delete'.'.'.$location,
                                        $this->errors, $this->templateVars, $node, $mergeSlug);

            $this->getErrors()->throwOnError();


            $this->RegulatedNodeService->delete($nodeRef, $mergeSlug);

            $location = 'post';
            $this->Events->trigger('NodeCmsController.delete'.'.'.$location, $this->errors, $this->templateVars, $node);
            foreach ((array)$nodeRef->getElement()->getAspects() as $aspect)
                $this->Events->trigger('NodeCmsController.@'.$aspect->Slug.'.'.'delete'.'.'.$location, $this->errors, $this->templateVars, $node);

            //redirect to news list (action_success_view)
            return new View($this->successView());
        }

        if ($this->cancelButtonPushed())
            //redirect to referer
            return new View('redirect:'.$this->Session->getFlashAttribute('delete_referer'));  //$this->cancelView());

        throw new Exception("unsupported button for this action");
    }
319046
public function delete()
	{
		\DB::delete('users_groups')
			->where('group_id', '=', $this->pk())
			->execute($this->_db);

		return parent::delete();
	}
505540
public function deleteFieldTypes($fieldTypes)
    {
        $schema = $this->get();
        $request = [];
        foreach ($fieldTypes as $fieldType) {
            if ($this->hasFieldType($fieldType, $schema)) {
                $request['delete-field-type'][] = ['name' => $fieldType];
            }
        }

        return $this->request($request);
    }
584657
public static function deleteAllProperties(&$models)
    {
        $storageHandlers = PropertyStorageHelper::getHandlersForModel(reset($models));

        Yii::beginProfile('Fill properties for models');

        foreach ($storageHandlers as $handler) {
            Yii::beginProfile($handler);

            $handler->deleteAllProperties($models);

            Yii::endProfile($handler);
        }
        Yii::endProfile('Fill properties for models');
        return $models;
    }
596729
def del_fields(self, *names):
        """"""
        cls = type(self)
        self.__class__ = cls
        for n in names:
            # don't raise error if a field is absent
            if isinstance(getattr(cls, n, None), DataField):
                if n in self._field_values:
                    del self._field_values[n]
                delattr(cls, n)
604100
def delete(self, **kwds):
        
        result = self._client.action.delete(self, **kwds)
        self._delete_fields()
        return result
328418
public function deleteList()
    {
        $process = $this->params()->fromQuery('process');
        $levels = $this->params()->fromQuery('levels');
        $nbDeleted = 0;
        
        if (! empty($process) && ! empty($levels)) {
            
            $process = explode(',', $process);
            $process = array_map(function ($proces)
            {
                $parts = array_merge(explode('-', $proces), array(
                    null,
                    null,
                    null
                ));
                return array(
                    'mode' => $parts[0],
                    'type' => $parts[1],
                    'endpoint' => $parts[2]
                );
            }, $process);
            $levels = explode(',', $levels);
            $nbDeleted = $this->getAlertDataHandler()->removeAllAlerts($process, $levels);
        }
        
        $deleted = array(
            "deleted" => $nbDeleted
        );
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $alertssJson = $serializer->serialize($deleted, 'json');
        $response->setContent($alertssJson);
        return $response;
    }
1316396
public function useFields($fields)
    {
        if (is_string($fields)) {
            $fields = explode(',', $fields);
        }
        $this->fields = $fields;

        return $this;
    }