PHP code example of palma / doctrineormserviceprovider

1. Go to this page and download the library: Download palma/doctrineormserviceprovider 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/ */

    

palma / doctrineormserviceprovider example snippets



...

$app->register(new Palma\Silex\Provider\DoctrineORMServiceProvider(), array(
    'doctrine_orm.entities_path'     => __DIR__.'/Entities/',
    'doctrine_orm.proxies_path'      => __DIR__.'/Proxies',
    'doctrine_orm.proxies_namespace' => 'MyProject\Proxies',
    'doctrine_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 = $['doctrine_orm.em']->find('Post', $id);
	
	return  "<h1>{$post->getTitle()}</h1>".
            "<p>{$post->getBody()}</p>";
});