Skip to main content
added 31 characters in body
Source Link
ssibal
  • 3.2k
  • 3
  • 19
  • 29
kint(Database::setActiveConnection('preview'));
\Drupal::logger('Little kitties')->info('Mau');
kint(Database::setActiveConnection('default'));

As my expectation this would create a watchdog entry in preview database. The entry got created in the default database instead.

This means, setActiveConnection() only affects direct queries (select and db_query..)? That would be really sad.

kint(Database::setActiveConnection('preview'));
\Drupal::logger('Little kitties')->info('Mau');
kint(Database::setActiveConnection('default'));

As my expectation this would create a watchdog entry in preview database. The entry got created in the default database instead.

This means, setActiveConnection() only affects queries? That would be really sad.

kint(Database::setActiveConnection('preview'));
\Drupal::logger('Little kitties')->info('Mau');
kint(Database::setActiveConnection('default'));

As my expectation this would create a watchdog entry in preview database. The entry got created in the default database instead.

This means, setActiveConnection() only affects direct queries (select and db_query..)? That would be really sad.

Source Link
ssibal
  • 3.2k
  • 3
  • 19
  • 29

Database::setActiveConnection not working as expected?

kint(Database::setActiveConnection('preview'));
\Drupal::logger('Little kitties')->info('Mau');
kint(Database::setActiveConnection('default'));

As my expectation this would create a watchdog entry in preview database. The entry got created in the default database instead.

This means, setActiveConnection() only affects queries? That would be really sad.