connection() public method

Get connection to use
public connection ( string $connectionName = null ) : Doctrine\DBAL\Connection
$connectionName string Named connection or entity class name
return Doctrine\DBAL\Connection
Example #1
0
 /**
  * Escape/quote identifier
  *
  * @param string $identifier
  * @return string
  */
 public function escapeIdentifier($identifier)
 {
     if ($this->_noQuote) {
         return $identifier;
     }
     return $this->mapper->connection()->quoteIdentifier(trim($identifier));
 }
Example #2
0
 /**
  *  Constructor Method
  *
  *  @param Spot_Mapper
  *  @param string $entityName Name of the entity to query on/for
  */
 public function __construct(\Spot\Mapper $mapper)
 {
     $this->_mapper = $mapper;
     $this->_entityName = $mapper->entity();
     $this->_tableName = $mapper->table();
     // Create Doctrine DBAL query builder from Doctrine\DBAL\Connection
     $this->_queryBuilder = $mapper->connection()->createQueryBuilder();
 }
Example #3
0
 /**
  * Drop Table
  *
  * @param string $table Table name
  * @return bool
  */
 public function dropTable($table)
 {
     $result = false;
     $connection = $this->mapper->connection();
     try {
         $result = $connection->getSchemaManager()->dropTable($table);
     } catch (\Exception $e) {
         $result = false;
     }
     return $result;
 }