im jest początkujący z doktryną. Właśnie zainstalowałem gruszka + doktryna 2.3.3 i chcę ją przetestować.Doctrine PHP Początkujący: Doctrine ORM Tools Setup nie został znaleziony
doktryny testu napisałem klasę o nazwie "osoba"
/**
* @Entity
*/
class person
{
/** @Id @Column(type="integer") @GeneratedValue * */
private $id;
/** @Column(type="string") * */
private $name;
/** @Column(type="string") * */
private $surname;
//some getters and setters ...
}
potem zrobiłem mój plik bootstrap.php, bootstrep_doctrine.php i CLI-config.php pliki i uruchom polecenie:
doctrine orm:schema-tool:create
to działa dobrze!
Ale teraz, gdy chcę to moje bootstrap.php w „normalnym” pliku php, aby stworzyć „osobą” pojawia się następujący błąd:
Fatal error: Class 'Doctrine\ORM\Tools\Setup' not found
in /var/www/vms/bootstrap_doctrine.php on line 15
Plik wygląda następująco:
<?php
$debug = true;
if($debug){
error_reporting(E_ALL);
ini_set("display_errors", "on");
ini_set("display_startip_errors", "on");
}
require_once '../bootstrap.php';
include_once ('testClassOrm.php');
$person = new person();
$person = new person();
$person->setName("Hans");
?>
bootstrap.php:
if(!class_exists("Doctrine\Common\Version", false)){
require_once 'bootstrap_doctrine.php';
}
bootstrap_doctrine.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array("entities/");
$isDevMode = true;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => 'TEST',
'password' => 'TEST',
'dbname' => 'test',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$em = EntityManager::create($dbParams, $config);
Sprawdziłem czy/usr/share/pear/jest w php_include path. i to jest ..
require_once 'System.php';
var_dump(class_exists('System', false));
to zwraca true:
ale ten robi return false:
use Doctrine\ORM\Tools\Setup;
var_dump(class_exists('Setup', false));
robię coś źle?
pozdrawiam
Zapomniałeś konfiguracji autoloading! Jak zainstalowałeś ORM? – Ocramius