Fos elastica在代码表中获取代码名称

时间:2018-08-29 07:06:29

标签: symfony elasticsearch foselasticabundle

我正在使用fosElastica填充Elasticsearch。我有两个实体,那个实体关系在一起。

但是我无法在商品索引中填充和显示类别名称。我该怎么办?

Entity / AirportCodes.php

/**
 * @var string $AirportCode
 *
 * @ORM\Column(name="AirportCode", type="string", length=3)
 * @ORM\OneToOne(targetEntity="XXXBundle\Entity\AirportCodesTrans")
 * @ORM\JoinColumn(name="AirportCode", referencedColumnName="airport_code", nullable=false)
 */
private $airportCode;

Services.yml

example-connect:
    properties:
        AirportCode: { type: text, analyzer: autocomplete }
        AirportSlug: ~
        CountryCode: ~
        CityCode: ~
    persistence:
        driver: orm
        model: XXXBundle\Entity\AirportCodes
        identifier: AirportCode
        provider: ~
        finder: ~

实体/机场代码交易

/**
 * @var int
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string $AirportCode
 *
 * @ORM\Column(name="airport_code", type="string", length=3)
 */
private $airportCode;

/**
 * @var string $lang
 *
 * @ORM\Column(name="lang", type="string", length=3)
 */
private $lang;

/**
 * @var string $name
 *
 * @ORM\Column(name="name", type="string", length=255)
 */
private $name;

0 个答案:

没有答案