Jump to main content Jump to doc navigation

xPDOManager.createSourceContainer

Other versions: 3.x — Found a problem? Please edit this page or report an issue.

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');