Exemple #1
0
 /**
  * Constructor Method
  *
  * @param \Spot\Mapper $mapper
  * @throws Exception
  * @internal param $Spot_Mapper
  * @internal param string $entityName Name of the entity to query on/for
  */
 public function __construct(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();
 }
 /**
  * Формирует выражение объединения текущей схемы со сторонней.
  *
  * @param string $type Тип объединения (INNER, LEFT, RIGHT, FULL и т.д.).
  * @param Mapper $addedSheme Mapper добавляемой сущности.
  * @param string $foreign Имя свойства текущей схемы.
  * @param string $target Имя свойство добавляемой схемы.
  *
  * @return string Результирующее объединение.
  */
 protected function join($type, Mapper $addedSheme, $foreign, $target)
 {
     return $type . ' JOIN ' . $addedSheme->table() . ' ON ' . $this->convert('!' . $foreign) . ' = ' . $addedSheme->convert('!' . $target);
 }