I'm trying to print out the $entity
variable im hook_entity_presave
because I want to see all of the properties and their values at the time of saving.
The problem is that every way I have tried to print out the information, I get out of memory limit PHP errors. My PHP settings are set to 1024M max memory.
I have tried print_r()
, var_dump()
and debug()
, all with the same result. I also tried dpm()
, which allows the page to continue without running out of memory, but nothing gets output.
function my_module_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
debug($entity, NULL, TRUE);
}
kint($entity);
Kint is the preferred method of inspecting arrays in Drupal 8.