Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2 and Doctrine 2
#21

[eluser]jonsaw[/eluser]
tselaty's tutorial was a great help!

I have a quick question though - how come the regular DQL queries don't work. Am I missing a step?

Example:

$dql = "SELECT model FROM product p WHERE p.id = ?1";

$products = $this->em->createQuery($dql)
->setMaxResults(15)
->setParameter(1, 1)
->getResult();

foreach ($products AS $product) {
echo $product->getModel() . "\n";
}

I keep getting this error: "APPPATH/libraries/Doctrine/ORM/Mapping/MappingException.ph"
#22

[eluser]jonsaw[/eluser]
OKAY! I finally got it to work. I think it was something to do with the "namespace":

SOLUTION:

$query = $this->em->createQuery('SELECT p.model FROM models\product p');
$products = $query->getResult();

foreach ($products AS $product) {
echo $product['model'] . "\n";
}
#23

[eluser]bluehat09[/eluser]
Try this setup:

http://www.tlswebsolutions.com/codeignit...neignited/

Finally, an easy installer that works in 5 minutes or less.
I have read a lot of tutorials to get Doctrine and CodeIgniter together but all seems to be very complicated.
I’m wondering why CodeIgniter or Doctrine doesn’t have such integration packages on their websites?
#24

[eluser]kamal lamichhane[/eluser]
Here's github repo for this:
https://github.com/wildlyinaccurate/Code...Doctrine-2




Theme © iAndrew 2016 - Forum software by © MyBB