• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter and Doctrine Association mapping failure

#1
[eluser]Unknown[/eluser]
I have been trying to integrate Codeigniter 2 with Doctrine 2
It is working properly when I have individual tables(tables with out any relations). But when I tried tables with mappings, I get some proxy errors.
Here s my models, controllers and the error

User.java
Code:
<?php

namespace models;

/**
* @Entity
* @Table(name="user")
*/
class User {
    /**
     * @Id
     * @Column(type="integer", nullable=false)
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;
    
    /**
     * @Column(type="string", length=32, unique=true, nullable=false)
     */
    private $username;
    
    /**
     * @Column(type="string", length=64, nullable=true)
     */
    private $password;

    /**
     * @Column(type="integer", nullable=false)
     * @ManyToOne(targetEntity="usergroup")
     * @JoinColumn(name="user_group", referencedColumnName="id")
     */
    private $user_group;

// .. Getters and Setters


}

UserGroup.java
Code:
<?php

namespace models;

/**
* @Entity
  * @Table(name="usergroup")
*/
class UserGroup{
    /**
     * @Id
     * @Column(type="integer", nullable=false)
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;

        /**
         * @Column(type="string")
         */
        private $name;

// .. Getters and Setters

}

TestController.php
Code:
class TestController extends MY_Controller {

    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        echo 'starting...' . '<br> <pre>';
                $user = $this->em->find('models\User',1);
                print_r($user);
        echo 'controller executed';
        
    }
    
}

Error

Fatal error: require() [function.require]: Failed opening required 'application//models/proxies\modelsUsergroupProxy.php' (include_path='.;C:\php\pear') in D:\wamp\www\ci2_with_doctrine2\application\libraries\Doctrine\ORM\Proxy\ProxyFactory.php on line 85

I get the error only when I do the mapping. If I have the usergroup as a string in the annotation, then I dont get any errors.

I am not sure what exactly has to be done...

#2
[eluser]zeratool[/eluser]
Code:
required ‘application//models/proxies\modelsUsergroupProxy.php’

i think you forgot to add '/' between proxies and modelsUsergroupProxy

my 2 cents

#3
[eluser]Unknown[/eluser]
Try create a folder named "proxies" in "models\".

I got similar error and after creating the folder it went away. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.