KnpLabs / DoctrineBehaviors

Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior
http://knplabs.com
MIT License
915 stars 300 forks source link

Upgraded from 1.6 to 2.3 #732

Closed kevin-xtn closed 1 year ago

kevin-xtn commented 1 year ago

I had to update my Symfony version from 4.2 to 4.4 therefore updating the DoctrineBehaviors bundle too.

$this->getId(); $this->getTranslatable()->getId()

I'm getting Attempted to call an undefined method named "getId".

It existed in the 1.6 version in trait TranslationMethods

<?php

namespace App\Entity;

use App\Entity\Traits\AuthorableTrait;
use App\Entity\Traits\GedmoTrait;
use App\Entity\Traits\SeoTrait;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/**
 * @ORM\Entity(repositoryClass="App\Repository\ProfessionRepository")
 * @ORM\Table(name="profession_translation")
 * @ORM\HasLifecycleCallbacks
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
 */
class ProfessionTranslation implements NormalizableInterface, TranslationInterface
{
    use TranslationTrait;
    use SeoTrait;
    use GedmoTrait;
    use AuthorableTrait;

    /**
     * Id.
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
alcohol commented 1 year ago

See https://github.com/KnpLabs/DoctrineBehaviors/blob/1.6.1/UPGRADE.md