Skip to content

What is the purpose of ArrayColumn? #778

Closed

Description

@jstnthms

Based on what I've read in this thread, array columns are useless, and the following excerpt from the documentation is wrong:

/**
 * @ORM\ManyToOne(targetEntity="Category", inversedBy="products")
 * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
 *
 * @GRID\Column(field="category.name", title="Category Name")
 * @GRID\Column(field="category.children.name", type="array", title="Category Children")
 */
protected $category;

Assuming category.children is some sort of -toMany relationship and category.children.name is a string, the above excerpt tells us that we can define an array column and have the bundle aggregate the data for us. This would make sense, but it doesn't seem to be the case.

First, I would like to know: if I had a Parent entity with OnetoMany Children entities, how can I display a grid of Parent entities with a column for the associated Children in one row/cell using an ArrayColumn annotation. I do not want to see Parent entities duplicated in this grid.

If that is not possible, I would like to see it made possible.

I would also like to see some sort of __toString() implementation for related entities. So, instead of field="children.name", we can simply omit it, and assume that Children::__toString() is implemented.

Activity

  1. Abhoryo commented on Dec 13, 2015

    @Abhoryo
    Member

    Array column is only use for array data store in the data base not entity.
    The documentation is wrong here. Sorry.

  2. modified the milestone: 2.3 on Dec 13, 2015
  3. qferr commented on Mar 6, 2016

    @qferr
    Contributor

    The documentation is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions