如何在EasyAdmin中创建依赖下拉列表

时间:2018-08-08 04:14:47

标签: symfony4 easyadmin

config / admin / customer.yaml

easy_admin:
    entities:
        Customer:
            class: App\Entity\Customer
            form:
                fields:
                  - name
                  - addressRegion # Many-to-one to App/Entity/Region
                  - addressCity   # Many-to-one to App/Entity/City
                  - addressStreet
                  - phone

App / Entity / City.php

/**
* @ORM\ManyToOne(targetEntity="Region")
* @ORM\JoinColumn(name="region_id", referencedColumnName="id"
*/
private $region;

public function getRegion() {
    return $this->region;
}

public function setRegion(RegionInterface $region) {
    $this->region = $region;
}

请向我显示路径,如何根据所选区域填充城市。

0 个答案:

没有答案