PHP code example of tea-m-speak-interface / doctrine-extensions
1. Go to this page and download the library: Download tea-m-speak-interface/doctrine-extensions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tea-m-speak-interface / doctrine-extensions example snippets
// Use Composer autoloading
Doctrine\Configuration();
// MySQL database configuration
$configuration->getConnectionOptions([
'default' => [
'driver' => 'pdo_mysql',
'dbname' => 'example_db',
'host' => 'localhost',
'user' => 'root',
'password' => '',
'prefix' => '',
],
]);
// Application/Doctrine configuration
$configuration->setDebugMode(true);
$configuration->setAutogenerateProxyClasses(true);
$configuration->setProxyDir("data/proxy");
$configuration->setResultCacheImpl(_CACHE_DRIVER_);
.....
// Custom configuration for Application
$configuration->setCustomConfigArray(['test'=> true, 'text' => 'hello']);
$configuration->getCustomConfig()->has('test');
echo $configuration->getCustomConfig()->get('text'); //hello
// Get Doctrine entity manager
$bootstrap = Webmasters\Doctrine\Bootstrap::getInstance();
$em = $bootstrap->getEntityManager();
echo $bootstrap->getConfiguration()->getCustomConfig()->get('text'); //hello
$bootstrap->getConfiguration()->getCustomConfig()->set('world',true);
echo $bootstrap->getConfiguration()->getCustomConfig()->get('world'); //(bool)true