php - Symfony2 gedmo SortablePosition annotation does not exist -


i want implement sortable behavior in doctrine entity using gedmo extensions.

my config:

services:     # kernelrequest listener     extension.listener:         class: {bundle name}\listener\doctrineextensionlistener         calls:             - [ setcontainer, [ @service_container ] ]         tags:             # translatable sets locale after router processing             - { name: kernel.event_listener, event: kernel.request, method: onlatekernelrequest, priority: -10 }             # loggable hooks user username if 1 in security context             - { name: kernel.event_listener, event: kernel.request, method: onkernelrequest }     gedmo.listener.tree:         class: gedmo\tree\treelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ]      gedmo.listener.translatable:         class: gedmo\translatable\translatablelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ]             # - [ setdefaultlocale, [ %locale% ] ]             # - [ settranslationfallback, [ false ] ]      gedmo.listener.timestampable:         class: gedmo\timestampable\timestampablelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ]      gedmo.listener.sluggable:         class: gedmo\sluggable\sluggablelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ]      gedmo.listener.sortable:         class: gedmo\sortable\sortablelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ]      gedmo.listener.loggable:         class: gedmo\loggable\loggablelistener         tags:             - { name: doctrine.event_subscriber, connection: default }         calls:             - [ setannotationreader, [ @annotation_reader ] ] 

entity:

namespace stenik\footerlinkbundle\entity; use gedmo\mapping\annotation gedmo; use doctrine\orm\mapping orm; use doctrine\common\collections\arraycollection; use symfony\component\validator\constraints assert; // use gedmo\translatable\translationinterface translatable; // use gedmo\mapping\annotation\sortableposition sortableposition;  /**  * @orm\table(name="footer_link")  * @orm\entity(repositoryclass="gedmo\sortable\entity\repository\sortablerepository")  * @gedmo\loggable  */ class footerlink {     use \a2lix\translationformbundle\util\gedmo\gedmotranslatable;      /**      * @gedmo\sortableposition      * @orm\column(name="position", type="integer")      */     private $position;      /** @orm\id @orm\generatedvalue @orm\column(type="integer") */     protected $id;      /**      * @gedmo\translatable      * @orm\column(name="title", type="string", length=255)      */     protected $title;      /**      * @orm\column(name="link", type="string", length=255)      */     protected $link;      /**      * @orm\column(name="target", type="string", length=255)      */     protected $target = '_self';      /**      * @orm\column(name="is_hidden", type="boolean", options={"default" = 0})      */     protected $is_hidden;      /**      * @gedmo\timestampable(on="create")      * @orm\column(name="created_at", type="datetime")      */     protected $created_at;      /**      * @gedmo\timestampable(on="update")      * @orm\column(name="updated_at", type="datetime")      */     protected $updated_at;      /**       * @orm\onetomany(targetentity="stenik\footerlinkbundle\entity\footerlinktranslation", mappedby="object", cascade={"persist", "remove"}, indexby="locale")      */     protected $translations;      public function __construct()     {         $this->translations = new arraycollection();     }      public function getid()     {         return $this->id;     }      public function gettitle()     {         return $this->title;     }      public function settitle($value)     {         $this->title = $value;     }      public function getlink()     {         return $this->link;     }      public function setlink($value)     {         $this->link = $value;     }      public function gettarget()     {         return $this->target;     }      public function settarget($value)     {         $this->target = $value;     }      public function getishidden()     {         return $this->is_hidden;     }      public function setishidden($is_hidden)     {         $this->is_hidden = $is_hidden;     }      public function getcreatedat()     {         return $this->created_at;     }      public function setcreatedat($created_at)     {         $this->created_at = $created_at;     }      public function getupdatedat()     {         return $this->updated_at;     }      public function setupdatedat($updated_at)     {         $this->updated_at = $updated_at;     }       public function __tostring()     {         return $this->gettitle() ?: 'n/a';     } } 

i have added service subscriber in bundle class:

public function boot(){     // doctrine 2 entity manager     $em = $this->container->get('doctrine.orm.default_entity_manager');      // event manager     $evm = $em->geteventmanager();     $sortablelistener = new \gedmo\sortable\sortablelistener;     $evm->addeventsubscriber($sortablelistener); } 

but when try update schema following error:

[doctrine\common\annotations\annotationexception]                                                                                                                                              [semantical error] annotation "@gedmo\mapping\annotation\sortableposition" in property stenik\footerlinkbundle\entity\footerlink::$position not exist, or not auto-loaded.  

after quite struggle, turns out doctrine extensions version using has changes(wip-2.4.0) , there no longer sortableposition , sortablegroup annotations sortable. fixed it.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -