/**
  * @param AbstractDatabase $db
  * @param AbstractQueryBuilder $queryBuilder
  */
 public function __construct(AbstractDatabase $db, AbstractQueryBuilder $queryBuilder = null)
 {
     $this->db = $db;
     $this->queryBuilder = $queryBuilder;
     $this->modelCache = new ModelCache();
     $this->transformerFactory = new TransformerFactory();
     if ($this->queryBuilder) {
         $this->queryBuilder->setDb($db);
     }
 }