To connect to database servers you must configure a database provider. Just like with the Cache module, you can configure multiple providers to connect to multiple databases at the same time.
Cherrycake is currently only compatible with MySQL and MariaDB servers.
Database providers are configured in the Database configuration file
Database.config.php.For example, if you want to connect to a MySQL database server, your Cache configuration file would look like this:
<?phpnamespace Cherrycake;$DatabaseConfig = ["providers" => ["main" => ["providerClassName" => "DatabaseProviderMysql","config" => ["host" => "localhost","user" => "user","password" => "password","database" => "cherrycake","charset" => "utf8mb4","cacheProviderName" => "engine"]]]];
Note we called our database provider
Just like Cache, some other modules use Database for many purposes, for example: The Session module uses a database connection to store information about sessions.
That's why in the Cherrycake Skeleton boilerplate you'll find the
/installdirectory containing some SQL scripts to create the tables some this modules need.