Jump to content

Doctrine 2 + CodeIgniter


MASNathan

Recommended Posts

Boas,

Estou com um problema nas relações entre tabelas, relação one-to-many.

A estrutura é a seguinte:

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.

$user = $this->doctrine->em->find('Entity\User', 3);
$user->getCreatedQuests(); //Devolve-me todos os registos

Mas quando tento procurar uma Quest,

$this->doctrine->em->find('Entity\Quest', 1);

é me retornado o seguinte erro:

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.