This topic contains 1 reply, has 1 voice, and was last updated by alfadhel.a 4 years, 7 months ago.
- Topic
Hi,
I am creating new entity with one LocalizedFallbackValue attribute.
using OroPlatform – Translations and LocalizationsEntity class
12345678910111213141516171819202122232425262728293031323334353637383940414243444546<?phpnamespace Test\EntityBundle\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config;use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField;use Oro\Bundle\LocaleBundle\Entity\LocalizedFallbackValue;use Test\EntityBundle\Model\ExtendRoom;/*** @ORM\Table(name="demo_room")* @ORM\Entity()*/class Room extends ExtendRoom{/*** @var int* @ORM\Id()* @ORM\GeneratedValue(strategy="AUTO")* @ORM\Column(type="integer")*/protected $id;/*** @ORM\ManyToMany(* targetEntity="Oro\Bundle\LocaleBundle\Entity\LocalizedFallbackValue",* cascade={"ALL"},* orphanRemoval=true* )* @ORM\JoinTable(* name="demo_room_name",* joinColumns={* @ORM\JoinColumn(name="room_id", referencedColumnName="id", onDelete="CASCADE")* },* inverseJoinColumns={* @ORM\JoinColumn(name="localized_value_id", referencedColumnName="id", onDelete="CASCADE", unique=true)* }* )*/protected $names;// Getters and setters}Extend class
12345678910111213141516171819<?phpnamespace Test\EntityBundle\Model;use Oro\Bundle\LocaleBundle\Entity\Localization;use Oro\Bundle\LocaleBundle\Entity\LocalizedFallbackValue;/*** @method LocalizedFallbackValue getName(Localization $localization = null)* @method LocalizedFallbackValue getDefaultName()* @method void setDefaultName()*/class ExtendRoom{public function __construct(){}}Bundle class
1234567891011121314151617181920212223242526272829<?phpnamespace Test\EntityBundle;use Test\EntityBundle\Entity\Room;use Oro\Bundle\LocaleBundle\DependencyInjection\Compiler\DefaultFallbackExtensionPass;use Symfony\Component\DependencyInjection\ContainerBuilder;use Symfony\Component\HttpKernel\Bundle\Bundle;class TestEntityBundle extends Bundle{/*** @param ContainerBuilder $container*/public function build(ContainerBuilder $container){parent::build($container);$container->addCompilerPass(new DefaultFallbackExtensionPass([Room::class => ['name' => 'names',]]));}}The issue is with getName() function
1request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "getName" of class "Test\EntityBundle\Entity\Room". Did you mean to call "getNames"?"Thanks in advanced
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.