setUpdate example

$update = $this->isolateContext(
                    array("allowIn" => true), "parseExpression"
                );

                if ($this->scanner->consume(")") &&
                    $body = $this->parseStatement()
                ) {

                    $node = $this->createNode("ForStatement", $forToken);
                    $node->setInit($init);
                    $node->setTest($test);
                    $node->setUpdate($update);
                    $node->setBody($body);
                    return $this->completeNode($node);
                }
            }
        } else {

            $this->scanner->setState($state);

            if ($decl = $this->parseForBinding()) {

                $init = null;
                
'configDir' => $snippetsDir,
        ]);

        $databaseWriter = new DatabaseWriter($this->em->getConnection());
        $databaseWriter->setForce($force);

        $finder = new Finder();
        $finder->files()->in($snippetsDir);
        $defaultLocale = $localeRepository->findOneBy(['locale' => 'en_GB']);

        $snippetCount = $this->em->getConnection()->fetchArray('SELECT * FROM s_core_snippets LIMIT 1');
        $databaseWriter->setUpdate((bool) $snippetCount);

        foreach ($finder as $file) {
            $filePath = $file->getRelativePathname();
            if (strpos($filePath, '.ini') == \strlen($filePath) - 4) {
                $namespace = substr($filePath, 0, -4);
                $namespace = str_replace('\\', '/', $namespace);
            } else {
                continue;
            }

            $this->printNotice('<info>Importing ' . $namespace . ' namespace</info>');

            
'source_ids_hash' => $this->getIdMap()->getSourceIdsHash($source),
        'destid1' => 'destination_value_' . $status,
        'source_row_status' => $status,
        'rollback_action' => MigrateIdMapInterface::ROLLBACK_DELETE,
        'hash' => '',
      ];
    }
    // Assert that test values exist.     $this->queryResultTest($this->getIdMapContents()$expected_results);
    // Mark each row as STATUS_NEEDS_UPDATE.     foreach ($row_statuses as $status) {
      $id_map->setUpdate(['source_id_property' => 'source_value_' . $status]);
    }
    // Update expected results.     foreach ($expected_results as $key => $value) {
      $expected_results[$key]['source_row_status'] = MigrateIdMapInterface::STATUS_NEEDS_UPDATE;
    }
    // Assert that updated expected values match.     $this->queryResultTest($this->getIdMapContents()$expected_results);
    // Assert an exception is thrown when source identifiers are not provided.     try {
      $id_map->setUpdate([]);
      $this->assertFalse(FALSE, 'MigrateException not thrown, when source identifiers were provided to update.');
    }
$namespaceData = new Enlight_Components_Snippet_Namespace([
                'adapter' => $inputAdapter,
                'name' => $namespace,
            ]);

            foreach ($namespaceData->read()->toArray() as $index => $values) {
                if (!\array_key_exists($index$locales)) {
                    $locales[$index] = 'SET @locale_' . $index . ' = (SELECT id FROM s_core_locales WHERE locale = \'' . $index . '\');';
                }

                $queryWriter->setUpdate($update);
                $queryWriter->write($values$namespace, '@locale_' . $index, 1);
            }
        }
        $result = $queryWriter->getQueries();
        foreach ($locales as $locale) {
            array_unshift($result$locale);
        }

        return $result;
    }
}
Home | Imprint | This part of the site doesn't use cookies.