New answers tagged

0

I will try to give you some tips, to get more informaiton about the data. First of all such data is not stored in the DB. To see what data that came with the original Drupal installation, you can download a clean drupal site and compare the DB's. Field tables are made by Drupal but the fields are made by the developers. It's hard to tell which tables are ...


1

Ok, yeah, I feel a bit silly now and was making this too difficult. There is a module for this for Drupal 8! I was able to accomplish what I needed with Views Custom Table. Thank you prkos for the comment.


1

You're not selecting the default database for the new connection. Try: $select = Database::getConnection('default', 'requestDB')->select('request'); $select->addExpression('Count(requestID)', 'rec_count'); $select->condition('dateCreated','DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)', '>='); $select->condition('ek_borrowerID','111'); $select->...


1

You need to use ->addExpression() instead of ->fields()


0

Assuming Entity API is installed we can use entity_delete_multiple which should be faster than deleting one every time. define("MY_VOCAB", "tags"); function _custom_zap_vocab() { $vocab = taxonomy_vocabulary_machine_name_load(MY_VOCAB); $tree = taxonomy_get_tree($vocab->vid); $tids = array_map(function($term){ return $term->tid; }, $...


1

You can use 'entity' field query $query = \Drupal::entityQuery('node'); $query->condition('status', 1); $query->condition('type', 'article'); $query->condition('field_some_field.entity:node.title', 'Referenced node title');


1

The only way I can think to do this is to override the entity's storage handler in hook_entity_type_alter() with a storage handler that provides the delete functionality you want. Something like // You're going to want to be sure you're extending the entity's original // storage handler. class CustomStorageHandler extends EntityStorageBase { /* * {@...


-2

I'm struggling with the same error, and had no time to dig the entire problem about Composer. But I came up with a workaround as follows: Delete core and vendor folders from your Drupal root directory. $ rm -rf core vendor From a fresh downloaded drupal, copy core and vendor folders to your Drupal root directory. $ cp -R core vendor /path/to/drupal/root/...


0

This is how I did it: $database = \Drupal::database(); $query = $database->select('node__field_node_url', 'nnu'); $query->addField('nnu', 'entity_id'); $query->condition('nnu.field_node_url_uri', "entity:node/" . $article->entity_id); $results = $query->execute()->fetchAll(); $count = count($results);


Top 50 recent answers are included