Hey all,
I’m having a bit of trouble using the TypoScript database-query
to fetch content from a custom domain model table.
I have a content element CtaWithContactPerson
, which should display a heading, text and one or more contact persons. For the contact persons I’m using an inline
type field:
// simplified field
'contact_persons' => [
'label' => 'Ansprechpartner',
'config' => [
'type' => 'inline',
"foreign_table" => "tt_content_contact_persons",
"foreign_field" => "tt_content",
'foreign_sortby' => 'sorting',
],
],
I store the inline elements in a new table, tt_content_contact_persons
.
Such an inline element has these columns:
// simplified columns
'columns' => [
'bodytext' => [
'label' => 'Text',
'config' => [
'type' => 'text',
],
],
'contact_person' => [
'label' => 'Ansprechpartner',
'config' => [
'type' => 'group',
'allowed' => 'tx_website_domain_model_teammember',
"minitems" => 1,
"maxitems" => 1,
],
],
],
There, I can select one of the team members from the table tx_website_domain_model_teammember
. Those are managed on root level in a backend module. That works fine.
But now I want to display that contact person / team member in my content element, so I need to fetch it beforehand using TypoScript.
cta_with_contact_person =< lib.contentElement
cta_with_contact_person {
templateName = CtaWithContactPerson
dataProcessing {
10 = database-query
10 {
table = tt_content_contact_persons
pidInList.field = pid
orderBy = sorting
where {
data = field:uid
intval = 1
wrap = tt_content=|
}
as = contactPersons
dataProcessing {
10 = database-query
10 {
table = tx_website_domain_model_teammember
orderBy = sorting
where {
data = field:contact_person
intval = 1
wrap = uid=|
}
as = person
dataProcessing {
10 = files
10 {
references.fieldName = image
sorting = title
sorting.direction = descending
as = image
}
}
}
}
}
}
}
The issue is that the person
array is empty. Something is not configured correctly when fetching from tx_website_domain_model_teammember
. I am trying to get the team member by uid
, which is stored in the field contact_person
.
Content element variable dump:
What did I do wrong here? Been trying to fix this for 3 hours. Cheers!