Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Drupal\hello_foo\Controller;
- use Drupal\Core\Controller\ControllerBase;
- /**
- * Displays the string "Hello Foo".
- */
- class HelloFooController extends ControllerBase {
- /**
- * Retrieve data from the users table.
- *
- * @return array
- * foo
- */
- private function getUsers($db) {
- return $db->query("SELECT * FROM {users}")->fetchAll();
- }
- /**
- * Display the markup.
- *
- * @return array
- * Distributive array containing the data to render.
- */
- public function content() {
- //$rs = \Drupal::database()->query("SELECT * FROM {users}")->fetchAll();
- foreach ($this->getUsers(\Drupal::database()) as $record) {
- $user = $record->uid . ':' . $record->uuid;
- \Drupal::logger('hello_foo')->notice('processing ' . $user);
- }
- return [
- '#type' => 'markup',
- '#markup' => $this->t('Hello Foo!'),
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment