Symfony Twig,持久收集的未定义索引

{{ dump(memory.memoryImages) }}

gives me: enter image description here

But

{{ dump(memory.memoryImages.getValues) }}

or

{{ dump(memory.memoryImages.first) }}

or

{% for memoryImage in memory.memoryImages %}
     ...
{% endfor %}

all give me:

An exception has been thrown during the rendering of a template ("Notice: Undefined index: Memory").

How can I get the memoryImage from memoryImages? Did I might got wrongly configured doctrine mappings?

Entity Memory has a oneToMany relation:

oneToMany:
    memoryImages:
        targetEntity: MemoryImage
        mappedBy: Memory
        cascade: ["persist", "remove"]

and MemoryImages Entity has a ManyToOne relation:

manyToOne:
    memory:
        targetEntity: Memory
        inversedBy: memorieImages
        joinColumn:
            name: memory_id
            referencedColumnName: id

Are you sure you are not calling Memory instead of your memory (maybe even somewhere higher up) cause the error message should reflect that with its proper case (note the capital letter).

As for accessing values a loop etc like you are showing should just be fine so another reason why I doubt its these little things, but in fact the most tiniest of things.

You have a couple different typos:

oneToMany:
    memoryImages:
        targetEntity: MemoryImage
        mappedBy: Memory             => mappedBy: memory // Use field name not field type
        cascade: ["persist", "remove"]

manyToOne:
    memory:
        targetEntity: Memory
        inversedBy: memorieImages    => inversedBy: memoryImages // Field name doesn't match
        joinColumn:
             name: memory_id
             referencedColumnName: id