0

So I know this is another "class X not found in namespace" but I can't find an answer to my senario:

I have a class "temp" (pretty name) that looks like that :

namespace DbBccCrawlBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * 
 * @ORM\Entity
 * @ORM\Table(name="temp")
 * 
  */
 class Temp
 {

/**
 * @var integer
 *
 * @ORM\Column(name="id", type="integer", nullable=false)
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="IDENTITY")
 */
private $id;

and the orm in config.yml :

orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    entity_managers:
        extranet:
            naming_strategy: doctrine.orm.naming_strategy.underscore
            auto_mapping: true
        bdb:
            naming_strategy: doctrine.orm.naming_strategy.underscore
            connection: bdb
            mappings:
                DbBccBdbBundle: ~
        crawl:
            naming_strategy: doctrine.orm.naming_strategy.underscore
            connection: crawl
            mappings:
                DbBccCrawlBundle: ~

the weird thing is the error itself :

The class 'DbBccCrawlBundle\Entity\Temp' was not found in the chain configured namespaces FOS\UserBundle\Entity, AppBundle\Entity, DbBccBiproBundle\Entity

I don't know why it search in this bundle (it should be DbBccCrawlBundle\Entity instead)

I've been searching all this afternoon, if you've got some ideas, please let me know.

Fire Frost
  • 95
  • 1
  • 14
  • Did you maybe change your namespace previously? Maybe you need to clear your cache like so: `php bin/console cache:clear --env=prod` – Alvin Bunk Apr 04 '17 at 15:58
  • already cleared cache thousands times today... and still doesn't work – Fire Frost Apr 04 '17 at 16:03
  • 1
    Maybe try a grep recursive to see if you can find which file it's included in like: `grep -R "DbBccBiproBundle" src` – Alvin Bunk Apr 04 '17 at 16:09
  • Antoine ~ /c/Users/Antoine/git/bcc.extranet $ grep -r "DbBccBiproBundle" src src/DbBccBiproBundle/DbBccBiproBundle.php:namespace DbBccBiproBundle; src/DbBccBiproBundle/DbBccBiproBundle.php:class DbBccBiproBundle extends Bundle – Fire Frost Apr 04 '17 at 16:13
  • Antoine ~ /c/Users/Antoine/git/bcc.extranet $ grep -r "DbBccCrawlBundle" src src/DbBccCrawlBundle/DbBccCrawlBundle.php:namespace DbBccCrawlBundle; src/DbBccCrawlBundle/DbBccCrawlBundle.php:class DbBccCrawlBundle extends Bundle src/DbBccCrawlBundle/Entity/Temp.php:namespace DbBccCrawlBundle\Entity; src/TechBundle/Controller/Crawl/CrawlStatusController.php:use DbBccCrawlBundle\Entity; src/TechBundle/Model/Crawl/CrawlStatusModel.php: // $temp = new \DbBccCrawlBundle\Entity\Temp; src/TechBundle/Model/Crawl/CrawlStatusModel.php: $temp = new \DbBccCrawlBundle\Entity\Temp; – Fire Frost Apr 04 '17 at 16:13
  • what am I looking at? (sorry I couldn't format the text) – Fire Frost Apr 04 '17 at 16:14
  • You searched for "DbBccCrawlBundle" not "DbBccBiproBundle" which is what you are looking for. If you are not familiar with something you should search online. Grep is a search utility, it shows you the files that contain the string in quotes. – Alvin Bunk Apr 04 '17 at 16:18
  • You can actually update your question in order to format additional information. I'm guessing you are using the wrong entity manager somewhere (bdb instead of crawl). Possibly in your security.yml file? – Cerad Apr 04 '17 at 16:39
  • what I have is 3 bundles that connect to diffrent tables in my database, there's crawl, bdb and the last one : bipro. The problem is that when I use doctrine to insert/update a new object temp in the crawl table, doctrine search for an inexisting object "temp" in bipro instead of crawl. And I don't know why. cache is clean, kernel is good and my tea is damn cold :( – Fire Frost Apr 04 '17 at 16:53
  • and it's not using bdb instead of crawl, I checked that – Fire Frost Apr 04 '17 at 16:58
  • auto_mapping can do some strange things even when applied to a different entity manager. Try replacing it with a mappings entry. And I assume that the entities in your two bundles are completely independent? No mappings between them? – Cerad Apr 04 '17 at 17:09
  • They should be independent. I'll try tomorow, left work already. thanks guys :) – Fire Frost Apr 04 '17 at 17:12
  • Can you try to add `type: annotation` under your bundle in mapping configuration. – malcolm Apr 04 '17 at 17:26
  • Kay, so I tried the annotation type, didn't change anything. Also, I deleted the bipro bundle, but the error is the same (but symfony doesn't chech bipro bundle) I'm trying to get rid of the auto_mapping but when I do, I can't connect to extranet database anymore (I can't loggin cause he doesn't have the users)... – Fire Frost Apr 05 '17 at 08:09
  • http://stackoverflow.com/questions/43226768/multiple-connections-with-doctrine-in-symfony-2-3 – Fire Frost Apr 05 '17 at 09:19

0 Answers0