I try to use the doctrine extension sortable
via the gedmo
extension. I installed the gedmo-package with composer and followed the instructions of the installation in symfony2. I use yaml
-files as mapping-information for doctrine.
My yaml-file:
AppBundle\Entity\Picture:
type: entity
table: pictures
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
[...]
type:
type: string
length: 20
position:
type: string
gedmo:
sortable:
groups: [type]
The field position did have the type int
, but I also tried string
, because that should cause an error by the yaml-driver of the sortable-extension (InvalidMappingException
).
But the error I always get is Integrity constraint violation: 19 NOT NULL constraint failed: pictures.position
. But in all examples of the sortable extension there is no need to specifically set a value for the position-field or to allow null in the yaml-file. Also I suppose, that the InvalidMappingException
should occur before the NOT NULL Exception
.
Because of this I think that the extension is not even used. The config-files I use:
My config.yml file:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: doctrine_extensions.yml}
[...]
My doctrine_extensions.yml file:
services:
# KernelRequest listener
gedmo.listener.sortable:
class: Gedmo\Sortable\SortableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ "@annotation_reader" ] ]