Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 14700

Doctrine 2 + CodeIgniter

$
0
0
Boas,

Estou com um problema nas relações entre tabelas, relação one-to-many.
A estrutura é a seguinte:

Código (SQL):
CREATE TABLE `users` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `email` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL,
  `name` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL,
  `creation_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

CREATE TABLE `quests` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `creator_id` INT(11) NOT NULL,
  `language` VARCHAR(2) COLLATE utf8_unicode_ci NOT NULL,
  `description` VARCHAR(140) COLLATE utf8_unicode_ci NOT NULL,
  `creation_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;

Podem consultar as Entities que eu criei aqui:
Users: https://github.com/ReiDuKuduro/MyQuest/blob/master/application/models/Entity/User.php
Quests: https://github.com/ReiDuKuduro/MyQuest/blob/master/application/models/Entity/Quest.php

Não sei se estou a fazer alguma coisa de errado mas o que é certo é que quando procuro por um user, está tudo ok, e conssigo obter as "quests_created" desse mesmo.
Código (PHP):
$user = $this->doctrine->em->find('Entity\User', 3);
$user->getCreatedQuests(); //Devolve-me todos os registos

Mas quando tento procurar uma Quest,
Código (PHP):
$this->doctrine->em->find('Entity\Quest', 1);
é me retornado o seguinte erro:
Código :
Fatal error: require(): Failed opening required 'application/models/Proxies/__CG__EntityUser.php' (include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in /Users/andre/Repos/MyQuest/application/libraries/Doctrine/ORM/Proxy/ProxyFactory.php on line 92

Cumps

Viewing all articles
Browse latest Browse all 14700