deleteFromJSON example

// create empty array if there are no exclusions             $promotionExclusions = [];

            if (\count($exclusions) > 0) {
                $firstResult = array_shift($exclusions);
                if (\array_key_exists('exclusion_ids', $firstResult)) {
                    // if there are exclusions, set them in array                     $promotionExclusions = json_decode((string) $firstResult['exclusion_ids'], null, 512, \JSON_THROW_ON_ERROR);
                }
            }

            $this->deleteFromJSON($id$promotionExclusions);

            // if there are no references in exclusions we don't need to update anything             if ((is_countable($promotionExclusions) ? \count($promotionExclusions) : 0) === 0) {
                continue;
            }

            // check for corrupted data in database. If a excluded promotion could not be found it will not be present in results             $results = $this->getExistingIds($promotionExclusions);

            if (\count($results) === (is_countable($promotionExclusions) ? \count($promotionExclusions) : 0)) {
                // if there is no corrupted data we will add id to all excluded promotions too
Home | Imprint | This part of the site doesn't use cookies.