Entity Relations

Relations can only be described using the Doctrine annotation configuration.

Entity description

/**
 * Class Invoice
 * @package AppBundle\Entity
 *
 * @ORM\Entity(repositoryClass="AppBundle\Repository\TimesheetsRepository")
 */
class Invoice {

    [...]

    /**
     * @var Project $project
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Project")
     * @ORM\JoinColumn(name="project_id", referencedColumnName="id")
     */
    private $project;
    
    [...]
    
}

The Invoice is linked to a project. A project could be linked to multiple invoices.

Yaml Configuration

The filterAttribute configuration key

In the YAML configuration of the project, just add a property 'filterAttribute' under the field. This property is used by the search to find required values for the linked entity.

The __toString method

The related class should have a __toString method. That method will be used to render values in forms and in list tables.

The 'expanded' configuration key

The 'expanded' configuration key expected true or false as value. It defines if the field should be displayed in an expanded state or not. By default, value is false.

This option is equivalent to the Symfony configuration :

Last updated