Jump to main content Jump to doc navigation

xPDOManager::createSourceContainer()

Creates the physical data container represented by a data source.

Syntax

API Docs: http://api.modxcms.com/xpdo/om/xPDOManager.html#createSourceContainer

void createSourceContainer (
   $dsn,
   [$username = ''],
   [$password = ''],
   [$containerOptions = null]
)

Examples

Create a database called 'MyDatabase'.

$newDatabaseName = 'MyDatabase';
$dsn = 'mysql:host=localhost;dbname='.$newDatabaseName.';charset=utf8';
$manager = $xpdo->getManager();
$manager->createSourceContainer($dsn,'myusername','mypassword');