Welcome Guest, Not a member yet? Register   Sign In
[Error] No mapping file found
#1

[eluser]Unknown[/eluser]
Hello,
I am having an issue with Code Igniter, using Doctrine 2.
I would be really glad if you guys could help me, as I have tried to find were the error is comming from, and it really seems to ellude me.

Here is the error i get :

Code:
Fatal error: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'No mapping file found named 'models.Lien.dcm.yml' for class 'models\Lien'.' in D:\workspace\inf340_dm\application\libraries\Doctrine\Common\Persistence\Mapping\MappingException.php on line 74

This is my acceuil.php controler :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Accueil extends CI_Controller {
function __construct() {
  parent::__construct();
  $this->load->library('doctrine');
  $this->load->helper('html');
  $this->load->helper('url');
  
}

public function index()
{

  $em = $this->doctrine->em;
  $repository = $em->getRepository('models\Lien');
  $data['liens']= $repository->findAll();

  $this->load->view('frontoffice/templates/header');
  $this->load->view('frontoffice/accueil_view', $data);
  $this->load->view('frontoffice/templates/footer');
}
}

This is my Lien model

Quote:<?php

namespace models;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Lien
*
* @Table(name="lien")
* @Entity(repositoryClass="\\models\\repositeries\\LienRepository")
*/

class Lien
{
/**
* @var integer $idLien
*
* @Column(name="id_lien", type="integer", nullable=false)
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $idLien;


/**
* @var string $description
*
* @Column(name="description", type="string", length=45, nullable=false)
*/
private $description;

/**
* @var string $titre
*
* @Column(name="titre", type="string", length=45, nullable=false, unique=false)
*/
private $titre;

/**
* @var integer $score
*
* @Column(name="score", type="integer", nullable=false)
*/
private $score;


/**
* @var string $url
*
* @Column(name="url", type="string", length=45, nullable=false)
*/
private $url;

/**
* @var Utilisateur
*
* @ManyToOne(targetEntity="Utilisateur")
* @JoinColumns({
* @JoinColumn(name="utilisateur_id", referencedColumnName="id")
* })
*/
private $utilisateur;

/**
* @var Type
* @ManyToOne(targetEntity="Type")
* @JoinColumns({
* @JoinColumn(name="Type_idType", referencedColumnName="idType")
* })
*/
private $typetype;

public function getTitre() {
return $this->titre;
}

}

This is my lien repository

Quote:<?php


namespace models\repositories;
use models\Lien;
class LienRepository extends \Doctrine\ORM\EntityRepository {

/**
* Crer un lien avec TOUT CE QUIL FAUT
* @param unknown_type $idLien
* @param unknown_type $description
* @param unknown_type $titre
* @param unknown_type $score
* @param unknown_type $url
* @param unknown_type $utilisateur
* @param unknown_type $typetype
*/
public function create($idLien,$description,$titre,$score,$url,$utilisateur, $typetype) {
$em = $this->getEntityManager();
//creation d'un utilisateur
//--------------------------------------------------------------------------------------------------------------

$em = $this->getEntityManager();
$repository = $em->getRepository('models\Lien');
$lien = new Lien($idLien,$description,$titre,$score,$url,$utilisateur, $typetype);




//--------------------------------------------------------------------------------------------------------------
try {
$em->persist($lien);
$em->flush();
} catch (\Exception $e) {
//echo $e->getMessage();
}

}

/**
* Permet de supprimer un lien en connaîssant son identifiant
* @param unknown_type $id l'identifiant
*/
public function delete($idLien) {
$em = $this->getEntityManager();

try {
//suppression d'un lien
//--------------------------------------------------------------------------------------------------------------
$lien = getLienById($idLien);
$em->remove($lien);

//--------------------------------------------------------------------------------------------------------------
$em->flush();
} catch (\Exception $e) {

};
}


/**
* Permet de modifier un lien
* @param unknown_type $utilisateur l'utilisateur ayant poster le lien
* @param unknown_type $idLien
* @param unknown_type $description
* @param unknown_type $titre
* @param unknown_type $score
* @param unknown_type $url
* @param unknown_type $utilisateur
* @param unknown_type $typetype
*/
public function updateUtilisateur($idLien,$description,$titre,$score,$url,$utilisateur, $typetype){
//l'identifiant ne peut-être modifié
$em = $this->getEntityManager();
//modification de le lien
//--------------------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------------------
$em->flush();
}

}

?>

And finally this is my view :

Code:
<div id='mid'>
<div id='box_lien'>
&lt;?php foreach ($liens as $lien): ?&gt;
  <p>

   <a> &lt;?php echo $lien->getTitre(); ?&gt; </a>
  </p>
  &lt;?php endforeach;?&gt;
</div>

<div id='box_formulaires'>

  <div id='connection'></div>
  <div id='soumission'></div>

</div>

</div>

I'm sorry for posting this huge text wall, but I want you to have all the info in case you can help me. Maybe the error is obvious and I missed it from looking at this code way to much...

IMO the error come from not having the right namespace in my model, or either not having having the right repositorie in my model.

PS: Sorry for my english, it is not my main language.

Cheers !




Theme © iAndrew 2016 - Forum software by © MyBB