The sample code to copy & paste after creating a new Oracle connection appears to use an older and now broken version of the entityManager functions. This did not work for me

For example, here is the code block I was given to copy & paste:

$entity_storage = \Drupal::entityTypeManager()->entityManager->getStorage("drupacle_connection"); 
$entity = $entity_storage->load("wfora"); 
$connObj = \Drupal::service("drupacle.connection_service")->drupalConnectionCallback($entity);
$Sql = oci_parse($connObj["wfora"], "YOUR QUERY"); 

This would result in errors like:
Notice: Undefined property: Drupal\Core\Entity\EntityTypeManager::$entityManager
Error: Call to a member function getStorage() on null

I was able to get this running by changing the first line to:

 $entity_storage = \Drupal::entityManager()->getStorage("drupacle_connection");

Not sure if that is exactly the correct way to do it but, it seems to be working now and also is closer to the example currently provided in the documentation.

Comments

Neil N created an issue. See original summary.

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar

Looking into this issue now.

dipohl’s picture

I experienced the same problem with drupacle v.2.0.1 and Drupal 9.4.1 and could solve it there by changing the first line of the snippet to:

$entity_storage = \Drupal::entityTypeManager()->getStorage("drupacle_connection");

  • yogeshmpawar committed b88c2833 on 2.0.x
    Issue #3130087 by Neil N, yogeshmpawar, dipohl: Error in sample code for...
yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
Status: Active » Fixed

committed & pushed to 2.0.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.