doctrine-extensions

How to fix “This repository can be attached only to ORM sortable listener” error in Gedmo sortable?

空扰寡人 提交于 2021-01-27 05:24:17
问题 When usieing StofDoctrineExtensions (which is a Symfony2 port of Gedmo Doctrine Extensions) Sortable behaviour I kept on getting this error: This repository can be attached only to ORM sortable listener Since I could not easily find the answer in official docs I'm leaving an answer here for future reference. 回答1: You need to enable any listeners you are using. In this case, Sortable. stof_doctrine_extensions: default_locale: en_US orm: default: sortable: true For Symfony 4, add this

How to fix “This repository can be attached only to ORM sortable listener” error in Gedmo sortable?

一个人想着一个人 提交于 2021-01-27 05:23:31
问题 When usieing StofDoctrineExtensions (which is a Symfony2 port of Gedmo Doctrine Extensions) Sortable behaviour I kept on getting this error: This repository can be attached only to ORM sortable listener Since I could not easily find the answer in official docs I'm leaving an answer here for future reference. 回答1: You need to enable any listeners you are using. In this case, Sortable. stof_doctrine_extensions: default_locale: en_US orm: default: sortable: true For Symfony 4, add this

DoctrineExtensions Notice: Undefined index: foreignKey in $em->getRepository('Gedmo\\Translatable\\Entity\\Translation');

让人想犯罪 __ 提交于 2019-12-25 05:34:36
问题 I try to save multiple translations like in this example, but I have an error. here is entity /** * @ORM\Entity * @Gedmo\TranslationEntity(class="BaseTranslation") * @ORM\Table(name="c_Base") */ class Base { /** * @ORM\Column(type="bigint") * @ORM\Id */ private $id; /** * Hexaid * @var string */ private $hid; /** * @ORM\Column(type="string") * @GRID\Column(title="name") * @Gedmo\Translatable * @var string */ private $name; /** * @ORM\Column(type="text", nullable=true) * @Gedmo\Translatable *

Slug not generated when persisting Entity to Database

醉酒当歌 提交于 2019-12-25 03:08:18
问题 I'm using DoctrineExtensions and followed the docs. I have my Entity field decorated with the Sluggable annotation: use Gedmo\Mapping\Annotation as Gedmo; . . . /** * @Gedmo\Slug(fields={"city"}, updatable=false) * @ORM\Column(length=255) */ private $slug; When I try to persist a new entity I get an SQL error: Persist: $em = $this->getDoctrine()->getManager(); $em->persist($location); $em->flush(); Error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'slug' cannot be null

how to populate data in 'closure' table if we have existing hierachy using parent_id in Gedmo doctrine tree extension?

假装没事ソ 提交于 2019-12-24 17:03:36
问题 I have existing category hierarchy with parent_id column. I have configured Gedmo Tree extension and update schema. I can see 'level' column is added to category table and category_closure table is created. How do I populate the data in category_closure table. There are no $repo->verify(); $repo->recover(); methods for ClosureTreeRepository. I have tried updating category records so that to trigger TreeListener but still there is no data in category_closure. How do I populate hierarchy in

How to disable Blameable-behaviour programmatically in Symfony2

岁酱吖の 提交于 2019-12-24 02:43:31
问题 I'm trying to run a console command in symfony2 in which some properties of a certain class are being updated. One of the properties has got a corresponding reviewedBy-property which is being set by the blameable-behaviour like so: /** * @var bool * @ORM\Column(name="public_cmt", type="boolean", nullable=true) */ private $publicCmt; /** * @var User $publicCmtReviewedBy * * @Gedmo\Blameable(on="change", field="public_cmt") * @ORM\ManyToOne(targetEntity="My\Bundle\EntityBundle\Entity\User") *

Sonata and Gedmo\References doctrine extension doesn't work ( Class does not exist )

夙愿已清 提交于 2019-12-23 01:12:48
问题 I want to link the doctrine orm entity and doctrine odm document and use them in sonataAdminBundle in configureFormFields Method of the Admin Class. I've established the @Gedmo\References doctrine-extension and it works just fine when i'm trying to access the linked models from controller. But now I need to do it from SonataAdminBundle - to make an UI to add the linked documents to the user entity. Here is my entity: <?php namespace Application\Sonata\UserBundle\Entity; use Doctrine\ORM

How to update left, right, level values on existing category hierarchy data using gedmo tree doctrine extension in symfony?

寵の児 提交于 2019-12-22 18:05:10
问题 http://sqlfiddle.com/#!9/1d4a6/1 I have existing hierarchical data for categories. I have been using traditional approach to get parent, child etc using parent_id. Now I am trying to use Gedmo doctrine extension for the same. I have installed the extension and updated schema. If I create new categories with parent child as given in documentation example, it works. It populates lft, lvl, rgt, root columns properly. $food = new Entity\Category(); $food->setTitle('Food'); $fruits = new Entity

How to configure doctrine extensions in Zend Framework 2?

家住魔仙堡 提交于 2019-12-21 05:15:45
问题 I have added this line to my composer.json: "gedmo/doctrine-extensions": "dev-master" And this is inside my module's module.config.php: 'doctrine' => array( 'driver' => array( __NAMESPACE__ . '_driver' => array( 'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity'), ), 'orm_default' => array( 'drivers' => array( __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver' ), ), ), ), Then I want to use

Gedmo Tree getPath Error: Node is not related to this repository 500 Internal Server Error - InvalidArgumentException

怎甘沉沦 提交于 2019-12-20 07:27:41
问题 I am getting error: Node is not related to this repository 500 Internal Server Error - InvalidArgumentException UPDATE 1: it does not matter if I set up tree repository with traits or extend abstract repository the error is the same. UPDATE 2: Full stack trace http://pastebin.com/TtaJnyzf I want to output html tree with tree structure from database and specifically I need to get path from root to selected node . As I understand it, that is done with getPath() function. I am using: Symfony v3