# Fos elastica get code name in code table

**URL:** <https://discuss.elastic.co/t/fos-elastica-get-code-name-in-code-table/146486>\
**Category:** Elasticsearch\
**Created:** [August 29, 2018, 8:25am UTC](https://discuss.elastic.co/t/fos-elastica-get-code-name-in-code-table/146486 "2018-08-29T08:25:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ercancavusoglu](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ercancavusoglu](https://discuss.elastic.co/u/ercancavusoglu)\
**Post date:** [August 29, 2018, 8:25am UTC](https://discuss.elastic.co/t/fos-elastica-get-code-name-in-code-table/146486/1 "2018-08-29T08:25:10Z")

</div>

I am using fosElastica for populate at elasticsearch. I have a two entity, that entities relationship together.

But I couldn't populate and show category name in products index. How can I to do?

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: ~

```

Entity/AirportCodesTrans

```
/**
 * @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;
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 26, 2018, 8:39am UTC](https://discuss.elastic.co/t/fos-elastica-get-code-name-in-code-table/146486/2 "2018-09-26T08:39:10Z")

</div>

Closed on September 26, 2018, 8:39am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
