I need the ID of the node the inserted comment is attached to. This is what I have tried:  function my-module_comment_insert(Drupal\Core\Entity\EntityInterface $entity) {     // According to https://drupal.stackexchange.com/questions/145823/how-do-i-get-the-current-node-id     $node = \Drupal::routeMatch()-&gt;getParameter('node');     if ($node instanceof \Drupal\node\NodeInterface) {         $nid = $node-&gt;id();     }     drupal_set_message("The vaue is " . print_r($nid), 'warning'); }   But... The value I get is "1", while it should be (according to node URL) "55". Or am I using drupal_set_message for debugging the wrong way?  I also tried $entity->get('entity_id')->target_id (according to:  ) or \Drupal::routeMatch()->getRawParameter('node'), but I always get "1" and I'm positive that the website cache has been cleared.
How can I get the node id the comment is attached to in hook_comment_insert?  I tried the following code:  function mymodule_comment_insert(Drupal\Core\Entity\EntityInterface $entity) {   if ($entity-&gt;bundle() == 'comment_custom' &amp;&amp; $entity-&gt;get('entity_type')-&gt;value == 'node') {      // Below returns empty, because "$entity-&gt;get('entity_id')-&gt;value" is empty.     $node = Node::load($entity-&gt;get('entity_id')-&gt;value);      // No luck with this one too.     $node = \Drupal::routeMatch()-&gt;getParameter('node');    } }
"To work for" vs. "to work in" vs. "to work at" My final goal is to generate Impulse Response Functions in R.  I have variables that are non stationary when I set k = 5 in a Unit Root test, and they are cointegrated which to my understanding prompts the use of the VECM, from which the Vec2Var argument is used to then generate IRFs. However, my response functions from this methodology do not decay over time and mostly do not revert to the zero line.  Furthermore, I noticed that when I input first differenced variables into the VECM as opposed to level data above, response function do revert to the zero line. Therefore my first question is: 1) is it appropriate to use differenced variables in a VECM model?  Secondly, as an alternative I am considering restricting the number of lags used in the Unit Root tests so that the variables are not all non-stationary; in this case 2) would the use of VECM be void and the VAR with first differences be a more appropriate model? Again, using differenced data is giving me better response functions that revert to zero in the long run. However, 3) is it ok to use the VAR for stationary/non-stationary data in levels where these variables are still cointegrated?  Also, I am using growth rate variables, 4) should I still long transform all variables and use logs in all tests?  Thank you for the help! URL to load resources from the classpath in Java Log form of variables and descriptive measures Because of larger values of variables, I did a log- transformation in my dataset. Now I want to give a descriptive table regarding my variables like mean, max, min, median, skewness, kurtosis. Can I give standard measures like arithmetic mean or should I give geometric mean? In terms of skewness or kurtosis, do I need a transformation? How to select distinct field values using Solr? Call to a member function on a non-object What happens when the Runner stack is empty? When the corporation R&amp;D is empty the corporation loses.  What happens when the Runner's stack is empty?    I think that: He must finish the game with only the cards on the table.  or  I doubt that: He reshuffles the heap into a new stack. Can I run a natural gas dryer from a portable propane tank? distribution with point support What would be the material or shaders node set up for a smooth gem in blender cycles engine?  I want a result similar to this image: How can I get my external IP address in a shell script? Update: (Originally this was a comment, but I thought it was worth sharing here at the top.)   In the original question, I asked if there was a polite, socially-acceptable way to ask an Indian co-worker not to use the phrase "do the needful", as I didn't care for it.   In the years since I asked this question I've asked many people about the phrase. To the Indians I've asked in-person, it's not rude in any way. To Americans I've asked it varies anywhere from "I don't like it, but I don't mind it" to "It's very rude and makes me angry when I see it".   Through a long series of edits the question morphed and I wasn’t able to delete it because it had upvoted answers. The question, as it stands now, has no other answer.  I guess, though, if you're non-Indian and you find it rude, or if you're Indian and you've never realized someone might find it rude, this post may still have merit. Hopefully it does. It certainly has gotten a lot of views. Best wishes, folks.  End Update. See below for what's left of the actual question.    "Do the needful."   It's a phrase that I've only seen used in email, and I find it . . . presumptuous (maybe even rude). Regardless of prefacing with "please", one is commanding rather than asking for assistance.  I've only seen it used by those of Indian origin, so I've simply not mentioned it at all rather than worry about any cross-cultural offense that may come of bringing it up.  But still, I don't understand why it's used. Why not request rather than make two statements, one factual, one imperative?  For example, why would one use:        I'm told you have Jane's email address. Please do the needful.      instead of,        Would you send me Jane's email address? In the past, both Philosophy and Science were one. However, because of the vastness of Science, it was cut off. I am inclined to go along the same line of thinking, but, is there a way to merge both disciplines once again? When I input [asdf][lisp] into the search field on , without being logged in, only one tag remains. Is it broken? The definite and zero article with the word "civilization" Difference between Hashing a Password and Encrypting it LaTeX multi-character subscript Draw a bivariate normal distribution in TikZ For a small class I want to draw a bivariate normal distribution and show where the means from the two variables meet in the space. Has anyone done this in TikZ? How can I get admin access to a Mac without knowing the current password? I have two user profile fields "Last Name" and "First Name". I also have a user list views. I want to expose "Name" as filter which can search for both Last Name and First Name. How can I do single filter of combination of those two fields? Can I create it from views UI?  One possible way is to create another profile field "Name" which will be hidden in the form. On user save, I would combine the two field values into the "Name" field and then expose it as filter in the views. But this solution is hard coding and it needs to write hooks.