Example #1
0
 /**
  * Disable direct access to mapper
  *
  * @param array|\ArrayObject|stdClass|\ArrayObject|object|string $entity
  * @param \Doctrine\DBAL\Driver\Connection $connection
  */
 public function __construct($entity, $connection = null)
 {
     $this->connection = $connection;
     if ($entity instanceof DefinitionInterface) {
         $this->setEntity($entity->getEntity());
         $this->definition = $entity;
     } elseif ($entity instanceof ProviderInterface) {
         $this->setEntity($entity->getEntity());
         $this->provider = $entity;
     } else {
         $this->setEntity($entity);
     }
 }