Saturday, 28 September 2013

One-To-One Self-referencing Problems

One-To-One Self-referencing Problems

I am trying to implement a One-to-One Self-referencing relationship in
Doctrine 2. So, my entity Membro_model is:
<?php
/**
*
* @Entity
* @Table(name="tb_membro")
*/
class Membro_model
{
/**
* @Id @Column(type="integer")
* @GeneratedValue(strategy="IDENTITY")
*/
public $id = 0;
/**
* @Column(type="string", columnDefinition="VARCHAR(50) NOT NULL")
*/
public $nome = 0;
/**
* @Column(type="string", columnDefinition="VARCHAR(50) NOT NULL")
*/
public $email = 0;
/**
* @Column(type="string", columnDefinition="VARCHAR(12) NOT NULL")
*/
public $login = 0;
/**
* @OneToOne(targetEntity="Membro_model")
* @JoinColumn(name="patrocinador_id", referencedColumnName="id")
**/
public $patrocinador;
}
I can persist entities. I am having problems in recover data. When the
field patrocinador_id is NULL, i have no problem in recover, but when the
field is not NULL the following error appears:
Fatal error: require(): Failed opening required
'application//models/proxies__CG__Membro_model.php'
(include_path='.;C:\php\pear') in C:\Program
Files\EasyPHP-DevServer-13.1VC9\data\localweb\eliteapp\application\third_party\DoctrineORM-2.2.2\libraries\Doctrine\ORM\Proxy\ProxyFactory.php
on line 93
I am trying to recover using findOneBy:
$membro =
$this->doctrine->em->getRepository('Membro_model')->findOneBy(array('login'
=> $login));
Please, help me!

No comments:

Post a Comment