Skip to content

Mapping issue for Loggable extension #306

@vgross

Description

@vgross

I have a mapping issue with the loggable extension. The extension works well to record each change and add that to the ext_log_entries table, but when I try to get a previous version by using the code in the example:

$repo = $em_report->getRepository('Gedmo\Loggable\Entity\LogEntry');
$obj = $em_report->find('Project\ReportBundle\Entity\CommissionData', 2715);
$logs = $repo->getLogEntries($obj);

I have got the issue:

"The class 'Gedmo\Tool\Wrapper\EntityWrapper' was not found in the chain configured namespaces Project\ReportBundle\Entity, Gedmo\Loggable\Entity"

here my config file

        orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        #auto_mapping: true
        default_entity_manager: report
        entity_managers:
            default:
                #metadata_cache_driver: apc
                #query_cache_driver: apc
                connection: default
                mappings:
                    FOSUserBundle: ~
                    ProjectApplicationBundle: ~
                    JMSPaymentCoreBundle: ~
            report:
                #metadata_cache_driver: apc
                #query_cache_driver: apc
                connection: report
                mappings:
                    ProjectReportBundle: ~
                    gedmo_loggable:
                        type: annotation
                        prefix: Gedmo\Loggable\Entity
                        dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                        alias: GedmoLoggable
                        is_bundle: false

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            timestampable: true
        report:
            timestampable: true       
            loggable: true

Entity:

<?php 
namespace Project\ReportBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;

/**
 * Project\ReportBundle\Entity\CommissionData
 *
 * @ORM\Table(name="commission_data")
 * @Gedmo\Loggable
 * @ORM\Entity(repositoryClass="Project\ReportBundle\Entity\Repository\CommissionDataRepository")
 */
class CommissionData
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

I use the code to get an old entry in a service and not in a controller, does that change something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions