Ich habe ein paar Felder in der Tabelle pages hinzugefügt. Meine Extbase Extension soll die neuen Felder mappen.
Man sollte meinen, dass das nicht so schwer sein kann, aber ich bekomme keine Ausgabe, egal wie ich es anstelle. Bin über jeden Tipp dankbar.
TypoScript:
plugin.tx_in2facebook = USER
plugin.tx_in2facebook {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Pi1
extensionName = In2facebook
controller = Opengraph
action = show
switchableControllerActions {
Opengraph {
1 = show
}
}
settings =
view {
templateRootPath = {$plugin.tx_in2facebook.view.templateRootPath}
partialRootPath = {$plugin.tx_in2facebook.view.partialRootPath}
layoutRootPath = {$plugin.tx_in2facebook.view.layoutRootPath}
}
persistence {
storagePid = 23
classes {
Tx_In2facebook_Domain_Model_Opengraph {
mapping {
tableName = pages
recordType = Tx_In2facebook_Domain_Model_Opengraph
columns {
tx_in2facebook_title.mapOnProperty = title
tx_in2facebook_type.mapOnProperty = type
tx_in2facebook_url.mapOnProperty = url
tx_in2facebook_image.mapOnProperty = image
tx_in2facebook_site_name.mapOnProperty = siteName
tx_in2facebook_admins.mapOnProperty = admins
tx_in2facebook_description.mapOnProperty = description
#uid.mapOnProperty = id
}
}
}
}
}
}
page.1 < plugin.tx_in2facebook
Controller:
public function showAction() {
$x = $this->opengraphRepository->findByUid($GLOBALS['TSFE']->id);
t3lib_div::debug($x, 'db');
t3lib_div::debug($GLOBALS['TSFE']->id, 'current pid');
}
Der Debug Output ist immer leer.
Ich werde wahnsinnig - recordType darf nicht gesetzt sein...
plugin.tx_in2facebook = USER
plugin.tx_in2facebook {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Pi1
extensionName = In2facebook
controller = Opengraph
action = show
switchableControllerActions {
Opengraph {
1 = show
}
}
settings =
view {
templateRootPath = {$plugin.tx_in2facebook.view.templateRootPath}
partialRootPath = {$plugin.tx_in2facebook.view.partialRootPath}
layoutRootPath = {$plugin.tx_in2facebook.view.layoutRootPath}
}
persistence {
storagePid = 23
classes {
Tx_In2facebook_Domain_Model_Opengraph {
mapping {
tableName = pages
# Fehlerhaft
# recordType = Tx_In2facebook_Domain_Model_Opengraph
columns {
tx_in2facebook_title.mapOnProperty = title
tx_in2facebook_type.mapOnProperty = type
tx_in2facebook_url.mapOnProperty = url
tx_in2facebook_image.mapOnProperty = image
tx_in2facebook_site_name.mapOnProperty = siteName
tx_in2facebook_admins.mapOnProperty = admins
tx_in2facebook_description.mapOnProperty = description
#uid.mapOnProperty = id
}
}
}
}
}
}
page.1 < plugin.tx_in2facebook
Das ist jetzt schon eine ganze Weile her. Aber kann mir mal jemand anhand dieses Beispiels erklären, was genau da geschieht?
Damit werden die Felder der DB-Tabelle Tx_In2facebook_Domain_Model_Opengraph mit denen aus der pages-Tabelle überschrieben. Wenn man innerhalb der Extbase-Extension dann auf tx_in2facebook_domain_model_opengraph.title zugreift, bekommt man den ursprünglichen Wert von page.title. Ist das richtig?
Werden dabei alle Spalten der pages-Tabelle berücksichtigt?
Hallo markus-fe. Hier wird nix überschrieben. Der Alex hat halt in seinem Model ein paar Eigenschaften, die so auch in der Tabelle pages vorkommen. Wenn er hier nichts geschrieben hätte, dann würde er mit getTitel() aus seinem Model auf die Spalte title von pages zugreifen. Er will aber auch nicht mit diesen mega fetten Gettern durch seine Extension latschen: getTxIn2facebookSiteName. Bei diesen langen Namen würde ihn jeder Integrator an den Hals gehen :-)
Also geht Alex her und sagt, dass alle Aufrufe aus seinem Model auf eine ganz bestimmte Spalte in der Tabelle gemappt werden. Man ließt es von links nach rechts:
tx_in2facebook_url.mapOnProperty = url
Der Inhalt von Spalte tx_in2facebook_url wird an die Modeleigenschaft url übergeben und ist somit per getUrl() erreichbar.
Die mapping-Eigenschaft ist echt mächtig. War es mapping.columns.[col].config mit dem man sogar die Eigenschaften der TCA überschreiben konnte? Ich hab das erst einmal gebraucht. Echt krank geil :-)
PS: Falls bei Extbase mal hinten was nicht rauskommt: debug_mysql_db! Kann ich nur empfehlen. Da sieht man dann sofort ob die pid falsch ist oder ob sich diese blöde type-Spalte wieder dazwischen gemogelt hat.
Stefan