Loading...
Skip navigation

Manipulate properties after import

In order to manipulate properties after import or creation there is a Signal/Slot and an event in the Openimmo-Extension. This Signal/Slot and event is always executed when for example the ImportCommand creates or changes properties.

In order to use the functionality you need to register an own Slot or event listener in your extension.

via Event Listener

Since version 6.0.9 there is a PSR-14 event available for that. You can find an example in Classes/EventListener/AfterCreationExample.php, the registration of the event listener is done in Configuration/Services.yaml.

via Signal/Slot

Create a Slot

First you need to create the Slot. This Slot can be created in a file called EXT:your_extension/Classes/Slot/ImmobilieSlot.php. In this file define a method that will be executed on receiving the Signal:

<?php

namespace YourVendor\YourExtension\Slot;

/**
 * Signal/Slot for immobilie objects
 *
 * This is just an example slot.
 *
 * @package openimmo
 *
 * @author Thomas Deuling <typo3(at)coding(dot)ms>
 */
class ImmobilieSlot
{

    /**
     * Executed after immobilie creation
     *
     * @param int $immobilieUid
     * @param int $immobilieUid
     * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
     * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
     */
    public function afterCreation(int $immobilieUid): void
    {
        // ...
    }

}

There is an example file in our extension in EXT:openimmo/Classes/Slot/ImmobilieSlot.php.

Register a Slot

You need to register your new Slot so that TYPO3 recognizes it. This also happens in your extension in the file EXT:your_extension/ext_localconf.php. Here you need the following code:

//
// Example Slot for manipulating immobilie after creation/modification
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
    \CodingMs\Openimmo\Command\ImportCommandController::class, 'afterCreation',
    \YourVendor\YourExtension\Slot\ImmobilieSlot::class, 'afterCreation'
);

After you have added the code you will need to clear the cache. Then each time properties are created or updated by the importer this method will be executed and you will be able to manipulate them.

Documentation
TYPO3 OpenImmo Extension

TYPO3 OpenImmo

TYPO3 OpenImmo is a real estate extension that reads in your objects via an OpenImmo import and displays them on your website.

Menu

Contact request

You can contact us at any time

Stop! Playing in the meantime?
Stop! Playing in the meantime?
Stop! Playing in the meantime?

Stop! Playing in the meantime?

Break the highscore

Press Start
Contact request
Screenreader label
Security question
2SE_________ZQQ______
__G____4____K_____WQ5
HWD___FJM___W9B______
L______P______5___G2F
HJJ_________SK7______