Created
June 11, 2018 17:21
-
-
Save algotrader-dotcom/ba647942e24c58f1b2e059ce0219fb22 to your computer and use it in GitHub Desktop.
Drupal 8 : Static db query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php /* Main */ | |
| use Drupal\Core\DrupalKernel; | |
| use Symfony\Component\HttpFoundation\Request; | |
| $autoloader = require_once 'autoload.php'; | |
| $kernel = new DrupalKernel('prod', $autoloader); | |
| $request = Request::createFromGlobals(); | |
| $response = $kernel->handle($request); | |
| use Drupal\node\Entity\Node; | |
| use Drupal\file\Entity\File; | |
| use Drupal\taxonomy\Entity\Term; | |
| $connection = \Drupal::database(); | |
| $query = $connection->query("select distinct title,changed from node_field_data order by changed limit 50"); | |
| $results = $query->fetchAll(); | |
| foreach ($results as $result) { | |
| print_r($result); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment