PHP code example of enyoslutions / doctrine-orm-service-provider
1. Go to this page and download the library: Download enyoslutions/doctrine-orm-service-provider 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/ */
enyoslutions / doctrine-orm-service-provider example snippets
...
$app->register(new Palma\Silex\Provider\DoctrineORMServiceProvider(), array(
'orm.entities_path' => __DIR__.'/Entities/',
'orm.proxies_path' => __DIR__.'/Proxies',
'orm.proxies_namespace' => 'MyProject\Proxies',
'orm.connection_parameters' => array(
'driver' => 'pdo_mysql',
'dbname' => 'dbname',
'user' => 'usename',
'password' => '******',
'host' => 'localhost',
'charset' => 'utf8',
)
));
$app->get('/blog/show/{id}', function ($id) use ($app) {
$post = $['orm.em']->find('Post', $id);
return "<h1>{$post->getTitle()}</h1>".
"<p>{$post->getBody()}</p>";
});