PHP code example of baohx2000 / doc

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

    

baohx2000 / doc example snippets




// Default entity manager.
$em = $app['orm.em'];



use Dflydev\Pimple\Provider\DoctrineOrm\DoctrineOrmServiceProvider;

$container = new \Pimple;

$container["db.options"] = array(
    "driver" => "pdo_sqlite",
    "path" => "/path/to/sqlite.db",
);

// ensure that $container['dbs'] and $container['dbs.event_manager']
// are available, most likely by way of a core service provider.

$container["orm.proxies_dir"] = "/path/to/proxies";
$container["orm.em.options"] = array(
    "mappings" => array(
        // Using actual filesystem paths
        array(
            "type" => "annotation",
            "namespace" => "Foo\Entities",
            "path" => __DIR__."/src/Foo/Entities",
        ),
        array(
            "type" => "xml",
            "namespace" => "Bat\Entities",
            "path" => __DIR__."/src/Bat/Resources/mappings",
        ),
        // Using PSR-0 namespaceish embedded resources
        // (



use Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Silex\Application;
use Silex\Provider\DoctrineServiceProvider;

$app = new Application;

$app->register(new DoctrineServiceProvider, array(
    "db.options" => array(
        "driver" => "pdo_sqlite",
        "path" => "/path/to/sqlite.db",
    ),
));

$app->register(new DoctrineOrmServiceProvider, array(
    "orm.proxies_dir" => "/path/to/proxies",
    "orm.em.options" => array(
        "mappings" => array(
            // Using actual filesystem paths
            array(
                "type" => "annotation",
                "namespace" => "Foo\Entities",
                "path" => __DIR__."/src/Foo/Entities",
            ),
            array(
                "type" => "xml",
                "namespace" => "Bat\Entities",
                "path" => __DIR__."/src/Bat/Resources/mappings",
            ),
            // As of 1.1, you can also use the simplified
            // XML/YAML driver (Symfony2 style)
            // Mapping files can be named like Foo.orm.yml
            // instead of Baz.Entities.Foo.dcm.yml
            array(
                "type" => "simple_yml",
                "namespace" => "Baz\Entities",
                "path" => __DIR__."/src/Bat/Resources/config/doctrine",
            ),
            // Using PSR-0 namespaceish embedded resources
            // (



use Dflydev\Cilex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Cilex\Application;
use Cilex\Provider\DoctrineServiceProvider;

$app = new Application('My Application');

$app->register(new DoctrineServiceProvider, array(
    /** same as the Silex example **/
));

$app->register(new DoctrineOrmServiceProvider, array(
    /** same as the Silex example **/
));

   
   $app['orm.ems.default'] = 'sqlite';
   $app['orm.ems.options'] = array(
       'mysql' => array(
           'connection' => 'mysql',
           'mappings' => array(), 
       ),
       'sqlite' => array(
           'connection' => 'sqlite',
           'mappings' => array(),
       ),
   );
   

   
   $emMysql = $app['orm.ems']['mysql'];
   $emSqlite = $app['orm.ems']['sqlite'];
   

   
   $emName = $app['orm.em_name_from_param']('3rdparty.provider.em');
   $em = $app['orm.ems'][$emName];
   

   
   $app['orm.ems.config'] = $app->share($app->extend('orm.ems.config', function ($config, $app) {
       $mapping = $app['orm.generate_psr0_mapping'](array(
           'Foo\Resources\mappings' => 'Foo\Entities',
           'Bar\Resources\mappings' => 'Bar\Entities',
       ));

       $chain = $app['orm.mapping_driver_chain.locator']();

       foreach ($mapping as $directory => $namespace) {
           $driver = new XmlDriver($directory);
           $chain->addDriver($driver, $namespace);
       }

       return $config;
   }));
   


$loader = on\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));