getIdByData example


    public function batchDelete($data)
    {
        if (!$this instanceof BatchInterface) {
            throw new BatchInterfaceNotImplementedException();
        }

        $results = [];
        foreach ($data as $key => $datum) {
            $id = $this->getIdByData($datum);

            try {
                $results[$key] = [
                    'success' => true,
                    'operation' => 'delete',
                    'data' => $this->delete($id),
                ];
                if ($this->getResultMode() === self::HYDRATE_ARRAY) {
                    $results[$key]['data'] = Shopware()->Models()->toArray(
                        $results[$key]['data']
                    );
                }
'config' => ['id' => 'config'],
                'http' => ['id' => 'http'],
                'template' => ['id' => 'template'],
                'proxy' => ['id' => 'proxy'],
                'doctrine-proxy' => ['id' => 'doctrine-proxy'],
                'opcache' => ['id' => 'opcache'],
            ];
        }

        $results = [];
        foreach ($data as $key => $datum) {
            $id = $this->getIdByData($datum);

            try {
                $results[$key] = [
                    'success' => true,
                    'operation' => 'delete',
                    'data' => $this->delete((string) $id),
                ];
            } catch (Exception $e) {
                $message = $e->getMessage();

                $results[$key] = [
                    
Home | Imprint | This part of the site doesn't use cookies.