Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration of EXT:extender - fields not visible in frontend #571

Open
Dani-mam opened this issue Aug 19, 2024 · 3 comments
Open

Configuration of EXT:extender - fields not visible in frontend #571

Dani-mam opened this issue Aug 19, 2024 · 3 comments

Comments

@Dani-mam
Copy link

We're in the process of updating a Typo3 page that had several fields added to tt_address. After updating EXT:extender to version 10.1.1. there is no frontend output of these fields anymore. The fields are visible in the backend and can be edited.

We've used this manual: https://docs.typo3.org/p/friendsoftypo3/tt-address/main/en-us/Development/ExtendTtAddress/Index.html#development-extend-ttaddress

Current Behavior
no frontend output of the additional fields

Expected behavior/output
The content of our fields should show up in the frontend.

Environment

  • TYPO3 version(s): 12.4.18
  • tt_address version: 9.0.1
  • Is your TYPO3 installation set up with Composer (Composer Mode): no
  • OS: Windows 10

Possible Solution
It looks like there were breaking changes in EXT:extender version 10. It would be nice, if the documentation of tt_address could be updated.

Additional context
Here is the code of our Address.php

<?php

namespace GeorgRinger\AddressField\Extending\Domain\Model;

class Address extends \FriendsOfTYPO3\TtAddress\Domain\Model\Address
{
    /** @var string */
    protected $adhinstitution = '';

    /**
     * @return string
     */
    public function getAdhInstitution()
    {
        return $this->adhinstitution;
    }

    /**
     * @param string $adhinstitution
     */
    public function setAdhInstitution($adhinstitution)
    {
        $this->adhinstitution = $adhinstitution;
    }
        
    /** @var string */
    protected $adhdepartment = '';

    /**
     * @return string
     */
    public function getAdhDepartment()
    {
        return $this->adhdepartment;
    }

    /**
     * @param string $adhdepartment
     */
    public function setAdhDepartment($adhdepartment)
    {
        $this->adhdepartment = $adhdepartment;
    }
    
    /** @var string */
    protected $adhstatus = '';

    /**
     * @return string
     */
    public function getAdhStatus()
    {
        return $this->adhstatus;
    }

    /**
     * @param string $adhstatus
     */
    public function setAdhStatus($adhstatus)
    {
        $this->adhstatus = $adhstatus;
    }    
}

ext_localconf.php

<?php

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['tt_address']['extender'][\FriendsOfTYPO3\TtAddress\Domain\Model\Address::class]['address_field'] = 'my_extension/Domain/Model/Address';	
      
@uv21
Copy link

uv21 commented Sep 24, 2024

We have the same problem with Typo3 12.4.20 (composer installation) / extender 10.1.1 / tt_address 9.0.1

@tntrpsw
Copy link

tntrpsw commented Oct 28, 2024

I could also reproduce the problem not being able to extend the table with own/custom fields using TYPO3 12.4.22 (legacy, NOT composer based installation) and tt_address 9.0.1.

The custom fields became available using the "old" approach extending $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] within the "ext_localconf.php" and the "Configuration/Extbase/Persistence/Classes.php" files like so:

file "ext_localconf.php"

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\FriendsOfTYPO3\TtAddress\Domain\Model\Address::class] = [
  'className' => \<VENDORNAME>\<EXTENSIONNAMESPACE>\Domain\Model\Address::class
];

file "Configuration/Extbase/Persistence/Classes.php"

return [

  // ...

  \<VENDORNAME>\<EXTENSIONNAMESPACE>\Domain\Model\Event::class => [
    'tableName' => 'tx_calendarize_domain_model_event',
  ],

];

Btw: I would like to know, why this "old" way is not the preferred way and why the "extender" extension is needed. Is it, because fo more complex models it's not working?

@georgringer
Copy link
Contributor

it is because xclassing works only 1 time, the extender makes it possible to extend a class multiple times. if you just need something in your project, feel free to do it this way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants