Currently, as discussed earlier in the chapter, the best tool for saving Entity state to a persistent store is Doctrine ORM. Doctrine has several ways to specify Entity metadata: by annotations in Entity code, by XML, by YAML, or by plain PHP. In this chapter, we'll discuss in depth why annotations are not the best thing to use when mapping Entities.
First of all, we need to require Doctrine through Composer. At the root folder of the project, the command below has to be executed:
> php composer.phar require "doctrine/orm=^2.5"
Then, these lines will allow you to set up Doctrine:
require_once '/path/to/vendor/autoload.php'; use Doctrine\ORM\Tools\Setup; use Doctrine\ORM\EntityManager; $paths = ['/path/to/entity-files']; $isDevMode = false; // the connection configuration $dbParams = [ 'driver' => 'pdo_mysql', 'user' => 'the_database_username', 'password' => 'the_database_password', 'dbname' => 'the_database_name...