How loosely coupled are ORM components in frameworks like Zend, allowing users to choose their preferred database access implementation?

In frameworks like Zend, ORM components are typically loosely coupled, allowing users to choose their preferred database access implementation by easily swapping out ORM components. This flexibility enables developers to use different ORM libraries or even raw SQL queries depending on their project requirements.

// Example of using different ORM components in a Zend framework project
// You can easily switch between different ORM libraries

// Using Doctrine ORM
$entityManager = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');

// Using Eloquent ORM
$eloquent = new EloquentModel();
$results = $eloquent->all();

// Using raw SQL queries
$sql = "SELECT * FROM table";
$statement = $this->getServiceManager()->get('Zend\Db\Adapter\Adapter')->query($sql);
$results = $statement->execute();