derhansen / sf_event_mgt

An event management and registration extension for TYPO3 CMS based on ExtBase and Fluid.
GNU General Public License v2.0
59 stars 55 forks source link

hint needed: expanding locations with mm-relation #779

Closed wini2 closed 4 years ago

wini2 commented 4 years ago

hello,

(sf_event_mgt 5.0.1/TYPO3 10.4.3)

i urgently need a little help. i need multiple location-fields (like speakers). what i have done so far:

created a new mm-table

CREATE TABLE tx_sfeventmgt_event_location_mm (
    uid_local int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
    sorting int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);

and altered tx_sfeventmgt_domain_model_event.php

        'location' => [
            ...
                'foreign_table' => 'tx_sfeventmgt_domain_model_location',
                'MM' => 'tx_sfeventmgt_event_location_mm',              
                //'size' => 1,
                'size' => 5,
                'minitems' => 0,
                //'maxitems' => 1,
                'maxitems' => 10,
                ...

when i use

<f :for each="{event.location}" as="ort" >
    <li>{ort.title}</li>
</f:for>

i only get the first enty.

debug output for speaker and location are dfferent speaker - TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorageprototypeobject location - DERHANSEN\SfEventMgt\Domain\Model\Locationprototypepersistent entity (uid=6, pid=7)

I would be very happy about a hint

derhansen commented 4 years ago

You only extend the TCA (Table Configuration Array) which is responsible to show the form field in the TYPO3 backend. The datatype of the property location used in Fluid Templates is defined in the Extbase model Event, so you need to override the existing model with your own version, where you define the property as ObjectStorage and also override the getters and setters for the property.

Please refer to my demo extension https://github.com/derhansen/sf_event_mgt_extend_demo/ which shows how to extend sf_event_mgt without modifying the original code of the extension.

Hope this helps