/**
  * 
  * @return string
  * @throws \Exception Raises exception if engine is not supported
  */
 private function FindEngineFolder()
 {
     $bundle = $this->manifest->BundleName();
     $sqlFolder = PathUtil::InstallationSqlFolder($bundle);
     if (!Folder::Exists($sqlFolder) || Folder::IsEmpty($sqlFolder)) {
         return '';
     }
     $engine = (string) $this->connection->Engine();
     $engineFolder = Path::Combine($sqlFolder, $engine);
     if (!Folder::Exists($engineFolder)) {
         throw new \Exception("Bundle {$bundle} doesn't support your database engine '{$engine}'");
     }
     return $engineFolder;
 }
 private function AddSetter(Php\Writer $writer, $table, $field)
 {
     $fieldInfo = $this->connection->GetFieldInfo($table, $field);
     $keyInfo = $fieldInfo->KeyInfo();
     //No setter for primary key!
     if ($keyInfo && $keyInfo->IsPrimary()) {
         return;
     }
     $class = $this->ClassName($table);
     $type = $this->GetValueTypeName($table, $field);
     $writer->StartDocComment();
     $writer->AddDocComment('Sets the ' . $this->GetNiceName($field) . ' of the ' . $this->GetNiceName($class) . '.');
     $writer->AddDocComment($type . ' $value', 'param');
     $writer->EndDocComment();
     $param = $this->GetValueParam($type, $fieldInfo->IsNullable());
     $writer->StartFunction('final function Set' . $field, array($param));
     $writer->AddCommand('$this->' . $field . ' = $value');
     $writer->EndFunction();
 }
 protected function __construct(DBInterfaces\IDatabaseConnection $connection)
 {
     $this->connection = $connection;
     $this->escaper = $connection->GetEscaper();
     $this->sqlLimiter = $connection->GetSqlLimiter();
 }