예제 #1
0
<?php

/**
 * Created by PhpStorm.
 * User: anouarattn
 * Date: 10/05/2015
 * Time: 15:14
 */
// bootstrap.php
require_once "vendor/autoload.php";
require_once 'src/EManager.php';
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array("src/EXPORT");
$isDevMode = true;
// the connection configuration
/*
$dbParams = array(
    'driver'   => 'pdo_mysql',
    'user'     => 'biellato',
    'password' => '10rofranak,',
    'dbname'   => 'biellato_ours',
);*/
$dbParams = array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => '', 'dbname' => 'biellato_ours_test');
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, null, null, false);
// or if you prefer yaml or XML
//$config = Setup::createXMLMetadataConfiguration(array(__DIR__."/config/xml"), $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode);
EManager::setEntityManager(EntityManager::create($dbParams, $config));
$entityManager = EManager::getEntityManager();
예제 #2
0
 /**
  * @param mixed $entityManager
  */
 public static function setEntityManager($entityManager)
 {
     self::$entityManager = $entityManager;
 }
function getNonConfirmedReservationStatus()
{
    $repo = EManager::getEntityManager()->getRepository('ReservationStatus');
    $station = $repo->findBy(array('id' => 1));
    if (count($station) == 1) {
        return $station[0];
    }
}
예제 #4
0
function echoTypeConsumerAsOptions()
{
    $repo = EManager::getEntityManager()->getRepository('ConsumerType');
    $types = $repo->findAll();
    foreach ($types as $type) {
        echo '<option id="' . $type->getId() . '">' . $type->getName() . '</option>';
    }
}