Closed seifane closed 1 year ago
Not familiar with this, but do you use Annotation driver? Seems like you should add the GedmoExtensionsServiceProvider
service provider in that case (http://www.laraveldoctrine.org/docs/1.0/extensions/installation)
I indeed use the annonation driver and used it previously successfully with SoftDeletable and Timestampable.
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
LaravelDoctrine\ORM\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
\LaravelDoctrine\ORM\DoctrineServiceProvider::class,
\LaravelDoctrine\ACL\AclServiceProvider::class,
\LaravelDoctrine\Extensions\GedmoExtensionsServiceProvider::class,
Here's my providers as declared in app.php
Just an update I've managed to get the table created by creating my own LogEntry entity and making it extend AbstractLogEntry
. I also added @Gedmo\Loggable(logEntryClass="VacationLogEntry")
on the entity that I want to be logged.
/**
* @ORM\Table(
* name="ext_log_entries",
* options={"row_format":"DYNAMIC"},
* indexes={
* @ORM\Index(name="log_class_lookup_idx", columns={"object_class"}),
* @ORM\Index(name="log_date_lookup_idx", columns={"logged_at"}),
* @ORM\Index(name="log_user_lookup_idx", columns={"username"}),
* @ORM\Index(name="log_version_lookup_idx", columns={"object_id", "object_class", "version"})
* }
* )
* @ORM\Entity(repositoryClass="Gedmo\Loggable\Entity\Repository\LogEntryRepository")
*/
class VacationLogEntry extends AbstractLogEntry
{
}
Now the table is created and I am able to retrieve log entries using EntityManager::getRepository(VacationLogEntry::class)->getLogEntries($entity)
.
Now I encounter another issue where when I want to revert an entity I get a Gedmo\Exception\RuntimeException
throw with the message The loggable listener could not be found
.
After investigating I found that the issue may come from gedmo/doctrine-extensions. I recently upgraded to version 2.4.42 and it seems the matching on the listener is done using an instanceof
expecting a LoggableListener
but a ResolveUserDecorator
is passed instead. I made a quick and dirty patch to unlock the situation for myself as I don't know why this was implemented that way in the first place. Let me know if you want me to create a pull request to fix this.
If you believe this is an issue with laravel-doctrine/extensions then please do open a PR and I will look into it, thanks! :+1:
Hi,
I have the same problem, is there anything new about it?
Thank you
Hello,
I've been trying to setup the Loggable extension on one entity and I keep getting an error that the table for log entries is not created.
I added the extension to the extensions list as stated in the docs :
Timestampable and SoftDeleteable have been working fine. I made sure to refresh and generate a migration using :
and the table still doesn't appear in the migration.
I really don't know if this is an issue on my side but I feel like I've exhausted all options at this point. If it's relevant I recently upgraded my laravel to version 8 here's a list of my dependencies with versions.