jonaswouters / XhprofBundle

XHProf bundle for Symfony 2
210 stars 49 forks source link

Inheritance Mapping in other database doesn't works #69

Open JonathanRamier opened 9 years ago

JonathanRamier commented 9 years ago

Hi,

I try to use you bundle, however I 've a problem when I implement a the bundle with a new database. My configuration looks like this

-- my jns_xhprof.yml

jns_xhprof:
    location_web:    http://profiler.api.me.lan/
    entity_manager:  profiler
    enabled:         true
    entity_class:    Acme\ProfilerBundle\Entity\XhprofDetail
    enable_xhgui:    true
    command: option
    command_option_name: xhprof

In my config.yml,

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   "pdo_pgsql"
                host:     "localhost"
                port:     "5432"
                dbname:   "app"
                user:     "user"
                password: "user"
                charset:  UTF8
            profiler:
                driver:   "pdo_pgsql"
                host:     "localhost"
                port:     "5432"
                dbname:   "profiler"
                user:     "profiler"
                password: "profiler"
                charset:  UTF8

    orm:
        default_entity_manager: default
        auto_generate_proxy_classes: "%kernel.debug%"
        entity_managers:
            default:
                connection: default
                mappings:
                    AcmeAppBundle:  ~
            profiler:
                connection: profiler
                mappings:
                    AcmeProfilerBundle:  ~

then I create my entity class like said in readMe

use Jns\Bundle\XhprofBundle\Entity\XhprofDetail as Base;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="details")
 */
class XhprofDetail extends Base
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="string", unique=true, length=17, nullable=false)
     * @ORM\Id
     */
    protected $id;
}

And when I deploy with the symfony command, my 'details' table contains only Id.

php app/console doctrine:schema:update --em=profiler

-- results

           Table "public.details"

 Column |         Type          | Modifiers 
--------+-----------------------+-----------
 id     | character varying(17) | not null

Why My entity doesn't inherit of the MasterMappedClass ? That very strange because when I unset the em=provider in my command, the table was generated correctly. Do I do a bad something ?

Cheers

stephpy commented 9 years ago

Hi,

Did you activate the bundle into your dev environment or only in test environment ?

JonathanRamier commented 9 years ago

Hi, I want to implement the bundle in a production environment for profiling. I added in Appkernel like this

$bundles = array(
            new Acme\AppBundle\AcmeAppBundle(),

            new Jns\Bundle\XhprofBundle\JnsXhprofBundle(),
            new Acme\ProfilerBundle\AcmeProfilerBundle(),
        );
stephpy commented 9 years ago

Did you registered many entityManagers ? Looks something like that ...