Du musst deine Klasse Certification um die Methode getUser erweitern 😉
Grundlage dafür ist, dass du auch das TCA entsprechend angepasst hast.
Es sieht also danach aus, als handele es sich bei dir um oben genannten Fall B).
Du musst also in deinem TCA für die Certification ein Feld für User anlegen, damit du vom Zertifikat auf den User zugreifen kannst. Aktuell ist es bei dir so konfiguriert, dass quasi nur der User von dem Zertifikat weiß, das Zertifikat allerdings nichts davon, dass es dem User zugeordnet ist.
Du musst also in deinem TCA das entsprechende Feld ergänzen, und die entsprechenden Settings dafür beachten. So eine Relation könnte beispielhaft so aussehen:
Im Model PaintRelations
'cluster' => array(
'exclude' => 1,
'label' => 'Related Cluster',
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_sb_domain_model_cluster',
'foreign_table' => 'tx_sb_domain_model_cluster',
'MM' => 'tx_sb_cluster_clusterpaint_mm',
'size' => 1,
'autoSizeMax' => 1,
'maxitems' => 1,
'multiple' => 0,
'selectedListStyle' => 'width:250px;',
'wizards' => array(
'_PADDING' => 5,
'_VERTICAL' => 1,
'suggest' => array(
'type' => 'suggest',
),
),
),
),
=> Im Model Cluster
'paint_relations' => array(
'exclude' => 1,
'label' => 'Paint-Relations',
'config' => array(
'type' => 'inline',
'internal_type' => 'db',
'allowed' => 'tx_sb_domain_model_clusterpaint',
'foreign_table' => 'tx_sb_domain_model_clusterpaint',
'MM' => 'tx_sb_cluster_clusterpaint_mm',
'MM_opposite_field' => 'cluster',
'size' => 100,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'selectedListStyle' => 'width:250px;',
'wizards' => array(
'_PADDING' => 5,
'_VERTICAL' => 1,
'suggest' => array(
'type' => 'suggest',
),
),
),
),
Dazu brauchst du natürlich für deine Relation eine MM-Tabelle, die die Relationen beinhaltet.
Über diese Relationstabelle werden dann die Relationen aufgelöst ( uid zu foreign uid und umgekehrt ).
Zusätzlich musst du natürlich die entsprechenden Felder in der DB-Tabelle anlegen und die entsprechenden Funktionen in deinen Klassen ergänzen.
Im Beispiel im Model Cluster:
/**
* paintRelations
*
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_Sb_Domain_Model_ClusterPaint>
* @lazy
*/
protected $paintRelations;
/**
* Adds a paintRelation
*
* @param Tx_sb_Domain_Model_ClusterPaint $paintRelations
* @return void
*/
public function addPaintRelations(Tx_sb_Domain_Model_ClusterPaint $paintRelation) {
$this->paintRelations->attach($paintRelation);
}
/**
* Removes a paintRelations
*
* @param Tx_sb_Domain_Model_ClusterPaint $paintRelations The Product to be removed
* @return void
*/
public function removePaintRelations(Tx_sb_Domain_Model_ClusterPaint $paintRelation) {
$this->paintRelations->detach($paintRelation);
}
/**
* Returns the paintRelations
*
* @return Tx_Extbase_Persistence_ObjectStorage<Tx_sb_Domain_Model_ClusterPaint> $paintRelations
*/
public function getPaintRelations() {
return $this->paintRelations;
}
/**
* Sets the paintRelations
*
* @param Tx_Extbase_Persistence_ObjectStorage<Tx_sb_Domain_Model_ClusterPaint> $paintRelations
* @return void
*/
public function setPaintRelations(Tx_Extbase_Persistence_ObjectStorage $paintRelations) {
$this->paintRelations = $paintRelations;
}
hier machst du also eigentlich genau das gleiche, wie du es schon bei deinem Model hast, von dem du auf die andere Klasse zugreifen kannst. Nur in die andere Richtung 😉
Hoffe das hilft dir weiter.