Bonjour
Je début avec Doctrine 2 (mais pas avec un ORM).
Je n'arrive pas à faire un simple find sur la première ligne dans ma table.
Tous semble Ok, le mapping, le chargement de la class ...
mais sur la ligne
j'obtient l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part $projet = $entityManager->find("Gestion_projets\projet", 1);
Je ne comprends pas le message d'erreur, un coup de main serait le bienvenuFatal error: Call to a member function getName() on a non-object in C:\wamp\www\dev\lib\doctrine-orm\Doctrine\ORM\Mapping\Driver\XmlDriver.php on line 54
Merci d'avance.
voici le mapping :
et voici la class :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21<?xml version="1.0" encoding="UTF-8"?> <orm:doctrine-mapping xmlns:orm="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping ../../../lib/doctrine-orm/xsd/doctrine-mapping.xsd "> <entity name="Gestion_projets\Projet" table="projet"> <id name="id" type="integer" column="id" nullable="false"> <generator strategy="AUTO" /> </id> <field name="type" type="integer" column="type_projet" nullable="false" /> <field name="etat" type="integer" column="etat" nullable="false" /> <field name="referenceClient" type="string" column="reference_client" nullable="false" /> <field name="nom" type="integer" column="nom" nullable="false" /> <field name="chefDeProjet" type="integer" column="id_cdp" nullable="false" /> <field name="commentaire" type="string" length="4000" column="commentaire" nullable="true" /> <field name="dateReception" type="datetime" column="date_reception" nullable="false" /> <field name="dateDebut" type="datetime" column="date_debut" nullable="true" /> <field name="dateFin" type="datetime" column="date_fin" nullable="true" /> <field name="cloturePar" type="integer" column="id_utilisateur_cloture" nullable="true" /> <field name="archive" type="integer" column="archive" nullable="true" /> </entity> </orm:doctrine-mapping>
plus simple tu meurt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <php namespace Gestion_projets; class Projet { public $id=null; // Id projet public $type=null; // Type de projet public $etat=null; // Etat projet public $referenceClient=null; // Reference client public $nom=null; // Nom du projet public $chefDeProjet=null; // Chef de projet public $commentaire=null; // Commentaire public $dateReception=null; // Date de reception du projet public $dateDebut=null; // Date de debut de projet public $dateFin=null; // Date de fin de projet public $cloturePar=null; // Utilisateur qui à clos la demande public $archive=null; // Projet archive } ?>![]()
Partager