vendredi 5 juin 2015

how include propel.yml in propel

I have problem while implementing propel with a sqlite dataBase.

I do the init script with this paramater image: Here

and when i use propel in php mode have this error

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/PdoConnection.php:49 Stack trace: #0 /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/PdoConnection.php(49): PDO->__construct('sqlite:', 'root', '', Array) #1 /var/client/vendor/propel/propel/src/Propel/Runtime/Adapter/Pdo/PdoAdapter.php(70): Propel\Runtime\Connection\PdoConnection->__construct('sqlite:', 'root', '', Array) #2 /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/ConnectionFactory.php(41): Propel\Runtime\Adapter\Pdo\PdoAdapter->getConnection(Array) #3 /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/ConnectionManagerSingle.php(76): Propel\Runtime\Connection\ConnectionFactory::create(Array, Object(Propel\Runtime\Adapter\Pdo\SqliteAdapter)) #4 /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/ConnectionManagerSingle.php(90): Propel\Runtime\Connection\ConnectionManagerSingle->getWriteConnection(Object(Propel\Run in /var/client/vendor/propel/propel/src/Propel/Runtime/Connection/ConnectionFactory.php on line 43

I have no probem when I use propel in command line (in the same folder that propel.yml)

here my includes and autoloader

require_once "../vendor/autoload.php";

function loadClass($className){
    $className=str_replace("\\","/",$className);
    $file = '../src/'.$className.".php";
    if (is_file($file)) {
        require_once $file;
        return;
    }     
}

spl_autoload_register('loadClass');
require_once '../src/Config/database/generated-conf/config.php';

my config.php

<?php
$serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
$serviceContainer->checkVersion('2.0.0-dev');
$serviceContainer->setAdapterClass('default', 'sqlite');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration(array (
  'dsn' => 'sqlite:',
  'user' => 'root',
  'password' => '',
  'settings' =>
  array (
    'charset' => 'utf8',
    'queries' =>
    array (
    ),
  ),
  'classname' => '\\Propel\\Runtime\\Connection\\ConnectionWrapper',
));
$manager->setName('default');
$serviceContainer->setConnectionManager('default', $manager);
$serviceContainer->setDefaultDatasource('default');

my propel.yml

propel:
database:
    connections:
        default:
            adapter: sqlite
            dsn: sqlite:
            user: root
            password: 
            settings:
                charset: utf8
paths:
    # The directory where Propel expects to find your `schema.xml` file.
    schemaDir: /var/client/src/Config/database

    # The directory where Propel should output generated object model classes.
    phpDir: /var/client/src

I thing that php dont acces the propel.yml where the schemaDir is set

Of course pdo_sqlite is instaled and activeted

Anyone have encounter this problem?

Aucun commentaire:

Enregistrer un commentaire