0

I have an entity that describes a task. This task can have children that are assembled via a parent ID. I now try to get a list of all children following a parent. But the code at dpm is not even reached.

(This is a controller that I created for the purpose of testing that the correct list of children is returned)

  public function content(){
    echo "attemting to get child";
    $entity = \Drupal::entityTypeManager()->getStorage('tasks')->load('11'); //Last breakpoint reached before error

    dpm($entity->getChildFollowUps($entity));
  }

I get an error

LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 2035 of core/lib/Drupal/Core/Database/Connection.php).

And I fail to understand why this doesn't work. Yes the ID in load(11) does exist, I checked that in the list view of the entity.

1
  • This is normal that you don't see the output of dpm() in case of an exception, sometimes you find the dpm() output in the message area of a random request later with no connection to the error. I think you need to review the entire custom code involved, not only the controller.
    – 4uk4
    Aug 11, 2022 at 13:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.