Hilfe bei ManyToOne und Associations

Hallo Comunity,

ich habe ein Plugin erstellt welches Fragen und Antworten hat/anzeigt. Das Plugin besteht aus (min.) zwei DB Tabellen: Questions und Answers. Ein Question kann dabei mehrere Answer haben.
Zuerst einmal, es funktioniert! Die Fragen könnten bearbeiter werden und Antworten auch :). Jetzt versuche ich es weiter anzupassen.


So jetzt habe ich in meiner Logik, dass jede Antwor t zur nächsten Frage führt. Somit müsste bei der Datailansicht der Antwort  eine Auswähl (Select) von alle Fragen kommen!

Backend Components - Associations
Eine Auswahl aller Fragen habe ich als Beispiel so realisiert: Link products to tax rates (ManyToOne) - vom dem oben Link 
Leider werden keine Fragen angezeigt und es gib keine Auswahlbox!

PHP Model/Antwort

namespace KreageQuiztool\Models;

use Shopware\Components\Model\ModelEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="kreagequiztool_answers")
 */
class Answer extends ModelEntity
{
    /**
     * @var integer $id
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer $question_id
     *
     * @ORM\Column(type="integer")
     */
    private $question_id;

    /**
     * @var integer $active
     *
     * @ORM\Column(type="integer")
     */
    private $active;

    /**
     * @var string $image
     *
     * @ORM\Column(type="text", nullable=true)
     */
    private $image;

    /**
     * @var string $text
     *
     * @ORM\Column(type="text", nullable=true)
     */
    private $text;

    /**
     * @var string $next_question_id
     *
     * @ORM\Column(type="integer")
     */
    private $next_question_id;

    /**
     * @var
     * @ORM\ManyToOne(targetEntity="KreageQuiztool\Models\Question", inversedBy="answers")
     * @ORM\JoinColumn(name="question_id", referencedColumnName="id")
     */
    protected $question;

    /**
     * @var
     * @ORM\ManyToOne(targetEntity="KreageQuiztool\Models\Question")
     * @ORM\JoinColumn(name="next_question_id", referencedColumnName="id")
     */
    protected $next_question;

    public function __construct()
    {
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $question_id
     */
    public function setQuestionId($question_id)
    {
        $this->question_id = $question_id;
    }

    /**
     * @return int
     */
    public function getQuestionId()
    {
        return $this->question_id;
    }

    /**
     * @param int $active
     */
    public function setActive($active)
    {
        $this->active = $active;
    }

    /**
     * @return int
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * @param string $image_path
     */
    public function setImage($image_path)
    {
        $this->image = $image_path;
    }

    /**
     * @return string
     */
    public function getImage()
    {
        return $this->image;
    }

    /**
     * @param string $text
     */
    public function setText($text)
    {
        $this->text = $text;
    }

    /**
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param int $next_question_id
     */
    public function setNextQuestionId($next_question_id)
    {
        $this->next_question_id = $next_question_id;
    }

    /**
     * @return string
     */
    public function getNextQuestionId()
    {
        return $this->next_question_id;
    }

    /**
     * @param mixed $question
     */
    public function setQuestion($question)
    {
        $this->question = $question;
    }

    /**
     * @return mixed
     */
    public function getQuestion()
    {
        return $this->question;
    }

    /**
     * @return mixed
     */
    public function getNextQuestion()
    {
        return $this->next_question;
    }

    /**
     * @param mixed $next_question
     */
    public function setNextQuestion($next_question)
    {
        $this->next_question = $next_question;
    }

}

JS Model/Antwort

Ext.define('Shopware.apps.KreageQuiztool.model.Answer', {
    extend: 'Shopware.data.Model',

    configure: function() {
        return {
            controller: 'KreageQuiztool',
            // controller: 'KreageQuiztoolAnswer',
            listing: 'Shopware.apps.KreageQuiztool.view.list.Answer',
            detail: 'Shopware.apps.KreageQuiztool.view.detail.Answer'
        };
    },

    fields: [
        { name : 'id', type: 'int', useNull: true },
        { name : 'question_id', type: 'int', useNull: true },
        { name : 'active', type: 'boolean', useNull: true },
        { name : 'image', type: 'string', useNull: false },
        { name : 'text', type: 'string', useNull: false },
        { name : 'next_question_id', type: 'int', useNull: true }
    ],

    associations: [{
        relation: 'ManyToOne',
        field: 'image',
        type: 'hasMany',
        model: 'Shopware.apps.Base.model.Media',
        name: 'getMedia',
        associationKey: 'media'
    }, {
        relation: 'ManyToOne',
        field: 'question_id',
        type: 'hasMany',
        model: 'Shopware.apps.KreageQuiztool.model.Question',
        name: 'getNextQuestion',
        associationKey: 'next_question'
    }]
});

Die View/Antwort hat eine default ausgabe (alle Felder werden ausgegeben). Die next_question sehe ich aber nicht und next_question steht nur ein Zahlenfeld. Ich würde aber gerne eine Auswal haben wo ich eine Frage (ID) auswählen kann.

Soll ich noch etws posten, um es besser nachzuvollziehen. 

Ich danke erst mal für die Hilfe :slight_smile: