Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6934923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:01:37+00:00 2026-05-27T12:01:37+00:00

I’m using Doctrine with Codeigniter. So i write a library class for using them

  • 0

I’m using Doctrine with Codeigniter. So i write a library class for using them together. But i cant access entities (after creating them from db with reverse-engineering). Doctrine gives error: Fatal error: Uncaught exception ‘Doctrine\ORM\Mapping\MappingException’ with message ‘Class Actions is not a valid entity or mapped super class.’

I just add this code for this situation to library class and works everything right but speed is very low:

    $this->em->getConfiguration()
             ->setMetadataDriverImpl(
                new DatabaseDriver(
                        $this->em->getConnection()->getSchemaManager()
                )
    );

What can i do for this error? I generated entities from DB with this function:

    $cmf = new DisconnectedClassMetadataFactory();
    $cmf->setEntityManager($this->em);
    $metadata = $cmf->getAllMetadata();
    $generator = new EntityGenerator();

    $generator->setUpdateEntityIfExists(true);
    $generator->setGenerateStubMethods(true);
    $generator->setGenerateAnnotations(true);
    $generator->generate($metadata, APPPATH."models/entities");

My Action entity:

<?php



/**
 * Actions
 *
 * @Table(name="actions")
 * @Entity
 */
class Actions
{
    /**
     * @var integer $id
     *
     * @Column(name="id", type="integer", nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $name
     *
     * @Column(name="name", type="string", length=45, nullable=false)
     */
    public $name;

    /**
     * @var string $nameSafe
     *
     * @Column(name="name_safe", type="string", length=45, nullable=false)
     */
    public $nameSafe;


    /**
     * Get id
     *
     * @return integer $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string $name
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set nameSafe
     *
     * @param string $nameSafe
     */
    public function setNameSafe($nameSafe)
    {
        $this->nameSafe = $nameSafe;
    }

    /**
     * Get nameSafe
     *
     * @return string $nameSafe
     */
    public function getNameSafe()
    {
        return $this->nameSafe;
    }
} 

(edit) My Library Code:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ArrayCache,
    Doctrine\DBAL\Logging\EchoSQLLogger,
    Doctrine\ORM\Mapping\Driver\DatabaseDriver,
    Doctrine\ORM\Tools\DisconnectedClassMetadataFactory,
    Doctrine\ORM\Tools\EntityGenerator;

    /**
     * CodeIgniter Doctrine Class
     *
     * initializes basic doctrine settings and act as doctrine object
     *
     * @author  Mehmet Aydın Bahadır
     * @link    http://www.biberltd.com/
     */
    class Doctrine {

          /**
           * @var EntityManager $em
           */
            public $em = null;

          /**
           * constructor
           */
          public function __construct()
          {
            // load database configuration from CodeIgniter
            require APPPATH.'config/database.php';

            // Set up class loading. You could use different autoloaders, provided by your favorite framework,
            // if you want to.
            require_once APPPATH.'third_party/Doctrine/Common/ClassLoader.php';

            $doctrineClassLoader = new ClassLoader('Doctrine',  APPPATH.'third_party');
            $doctrineClassLoader->register();
            $entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/" ));
            $entitiesClassLoader->register();
            $proxiesClassLoader = new ClassLoader('proxies', APPPATH.'models');
            $proxiesClassLoader->register();

            // Set up caches
            $config = new Configuration;
            $cache = new ArrayCache;
            $config->setMetadataCacheImpl($cache);
            $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH.'models/entities'));
            $config->setMetadataDriverImpl($driverImpl);
            $config->setQueryCacheImpl($cache);

            // Proxy configuration
            $config->setProxyDir(APPPATH.'models/proxies');
            $config->setProxyNamespace('Proxies');

            // Set up logger
            //$logger = new EchoSQLLogger;
            //$config->setSQLLogger($logger);

            $config->setAutoGenerateProxyClasses( TRUE );
            // Database connection information
            $connectionOptions = array(
                'driver' => 'pdo_mysql',
                'user' =>     $db['default']['username'],
                'password' => $db['default']['password'],
                'host' =>     $db['default']['hostname'],
                'dbname' =>   $db['default']['database']
            );

            // Create EntityManager
            $this->em = EntityManager::create($connectionOptions, $config);
//          $this->generate_classes();

          }

          /**
           * generate entity objects automatically from mysql db tables
           * @return none
           */
          public function generate_classes(){     

//            $this->em->getConfiguration()
//                     ->setMetadataDriverImpl(
//                        new DatabaseDriver(
//                                $this->em->getConnection()->getSchemaManager()
//                        )
//            );

            $cmf = new DisconnectedClassMetadataFactory();
            $cmf->setEntityManager($this->em);
            $metadata = $cmf->getAllMetadata();
            $generator = new EntityGenerator();

            $generator->setUpdateEntityIfExists(true);
            $generator->setGenerateStubMethods(true);
            $generator->setGenerateAnnotations(true);
            $generator->generate($metadata, APPPATH."models/entities");

          }

    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:01:37+00:00Added an answer on May 27, 2026 at 12:01 pm

    Solution is editing php.ini file for closing eAccelerator:

    eaccelerator.enable="0"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.