Delete existing cost center (soft delete)

@param array $data
An array as follows: array($id0, $id1,…);
@return boolean
194920
public function delete(array $data)
  {
    foreach ($data as $key => $id)
    {
      $CostCenter = $this->byId($id);
      $CostCenter->delete();
    }
    // $this->CostCenter->destroy($data);

    return true;
  }
762418
public function destroy(Data $data)
    {
        if ($this->isReadonly()) {
            throw new \RuntimeException($this->class . ' is readonly');
        }

        if ($data->isFresh()) {
            return true;
        }

        $this->__before('delete', $data);

        if (!$this->doDelete($data)) {
            throw new \Exception($this->class . ' destroy failed');
        }

        $this->__after('delete', $data);

        Registry::getInstance()->remove($this->class, $data->id(true));

        return true;
    }
248171
function del($data)
    {
        $index = $this->has($data);

        if ($index === false)
            return false;

        $current = $this->__mapped_items;
        unset($current[$index]);

        $this->clean();
        foreach ($current as $item)
            $this->insert($item['data'], $item['priority']);

        return $this;
    }
962053
public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->invoiceHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        return $this->update($data, $line);
    }
786978
public function deleteCategory($data = [])
    {
        $client = $this->getClient();
        $errors = [];

        if ($category = $this->getCategory($data['code'])) {
            $result = $client->delete($category);

            $errors = array_merge($errors, $client->getErrors($result));
            if (count($errors)) {
                Injector::inst()->get(LoggerInterface::class)->error('deleteCategory errors - ' . json_encode($errors));
            }
        }
    }
1097812
public function delete(array $data, $databaseConnectionName = null)
  {
    foreach ($data as $key => $id)
    {
      $Apportionment = $this->byId($id, $databaseConnectionName);
      $Apportionment->delete();
    }
    // $this->Account->destroy($data);

    return true;
  }
348706
protected function setPrice(array &$data)
    {
        if (!empty($data['price']) && !empty($data['currency'])) {
            $data['price'] = $this->price->amount($data['price'], $data['currency']);
        }
    }
78888
public static function deserializeObject(array $data)
    {
        /** @var Bulk $result */
        $result = parent::deserializeObject($data);
        $result->maxOperations = $data['maxOperations'];
        $result->maxPayloadSize = $data['maxPayloadSize'];

        return $result;
    }
592208
protected function internalUpdateFromData(array $data) {
        $initializing = $this->initializing;
        $this->initializing = true;
        $this->readOnlyOverride(function() use ($data) {
            return $this->updateFromData($data);
        });
        $this->initializing = $initializing;
    }
515673
public function remove($data)
    {
        $data = $this->fetchRemainingSegment($this->data, $data);
        if (! is_null($data)) {
            $this->set($data);
        }
    }
1026555
public function initFromArray(array $data) {

        $this->traitInitFromArray($data);

        if (!empty($data['buy'])) {
            $this->setBuy((new LimitActionPart())->initFromArray($data['buy']));
        }

        if (!empty($data['instant_buy'])) {
            $this->setInstantBuy((new LimitActionPart())->initFromArray($data['instant_buy']));
        }

        if (!empty($data['sell'])) {
            $this->setSell((new LimitActionPart())->initFromArray($data['sell']));
        }

        if (!empty($data['deposit'])) {
            $this->setDeposit((new LimitActionPart())->initFromArray($data['deposit']));
        }

        return $this;

    }
436671
public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->quotationHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        foreach( $merged as $name => $value )
        {
            if( is_null($value) )
                continue;

            switch($name)
            {
                case 'description':
                    $this->description($line, $value);
                    break;
                case 'price':
                    $this->price($line, $value);
                    break;
                case 'discount':
                    $this->discount($line, $value);
                    break;
                case 'qty':
                    $this->qty($line, $value);
                    break;
                case 'unit':
                    $this->unit($line, $value);
                    break;
            }
        }
    }
286060
public function clearExpired(&$Data)
    {
        if (!is_array($Data)) {
            return false;
        }
        $Cleared = false;
        $Updated = [];
        foreach ($Data as $Key => $Value) {
            if (is_array($Value)) {
                foreach ($Value as &$SubValue) {
                    if (is_array($SubValue)) {
                        if ($this->clearExpired($SubValue)) {
                            $Cleared = true;
                        }
                    }
                }
                unset($SubValue);
            }
            if (!is_array($Value) || !isset($Value['Time']) || $Value['Time'] > time()) {
                $Updated[$Key] = $Value;
            } else {
                $Cleared = true;
            }
        }
        $Data = $Updated;
        return $Cleared;
    }
104478
protected function cleanFormData(array $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value)) {
                $data[$key] = $this->cleanFormData($value);
            } elseif (\is_object($value)) {
                unset($data[$key]);
            }
        }

        return $data;
    }
79490
public function delete ($data = null)
		{
			$this->_options[ CURLOPT_CUSTOMREQUEST ] = 'DELETE';
			if ($data != null)
				$this->_options[ CURLOPT_POSTFIELDS ] = is_array($data) ? http_build_query($data) : $data;

			return $this->send();
		}
236990
private function manageSessionsToDelete(array &$data)
    {
        $secondsSinceLastWindow = $this->time() - $data['windowStart'];
        $inUseCount = count($data['inUse']);

        if ($secondsSinceLastWindow < self::WINDOW_SIZE + 1) {
            if ($data['maxInUseSessions'] < $inUseCount) {
                $data['maxInUseSessions'] = $inUseCount;
            }

            return;
        }

        $totalCount = $inUseCount + count($data['queue']) + count($data['toCreate']);
        $windowsPassed = (int) ($secondsSinceLastWindow / self::WINDOW_SIZE);
        $deletionCount = min(
            $totalCount - (int) round($data['maxInUseSessions'] / $windowsPassed),
            $totalCount - $this->config['minSessions']
        );
        $data['maxInUseSessions'] = $inUseCount;
        $data['windowStart'] = $this->time();

        if ($deletionCount) {
            $this->deleteQueue += array_splice(
                $data['queue'],
                (int) -$deletionCount
            );
        }
    }
1353484
protected function delete($data = null)
    {
        if ($this->hasMethod('__delete') && is_callable([$this, '__delete'])) {
            return $this->__delete($data);
        }

        // notify observers about new data
        $this->notify();
    }