6

The created date is stored in the node_field_data table as a UNIX timestamp in a cloumn called created. Here's the code you would use to fetch the nodes that has been created X days ago, using a direct select query. $day = 86400; // One day in seconds. $days = 3; // The amount of days ago to fetch from. $nids = \Drupal::database()->select('...


3

If you go into your Drupal database you should find a table called 'node_field_data'. In this table there is a column labeled 'created'. That will be your Unix timestamp for when the node was created.


2

For input, saving to the DB, Database API takes care of it, automatically prevents SQL injection when using dynamic query. Since your code is using dynamic query, you're all good. If you were to use static query you have to make sure you use placeholders as the docs mention. For output, to prevent XSS, you'll want to use a template file, and print your ...


2

Here is an example of sortable table with pagination. $header = [ 'label' => [ 'data' => $this->t('ID'), 'specifier' => 'nid', ], 'replies' => [ 'data' => $this->t('Title'), 'specifier' => 'title', ], 'created' => [ 'data' => $this->t('Created'), 'specifier' => 'created', // Set ...


1

Use an Drupal::entityQuery. The node table doesn't contain the status. $nids = \Drupal::entityQuery('node') ->condition('type','homepage_slide') ->condition('status', 1); ->execute(); $nodes = \Drupal\node\Entity\Node::loadMultiple($nids); // Loop through all nodes. foreach ($nodes as $node) { // ... }


1

I got it working for MySQL with the extra option: $> drush sql-dump --extra="--routines" References: Drush command: https://drushcommands.com/drush-8x/sql/sql-dump/ MySQL dump options: https://dev.mysql.com/doc/refman/5.5/en/mysqldump-stored-programs.html


Only top voted, non community-wiki answers of a minimum length are eligible