[TYPO3-mvc] relation to hidden objects

Sebastian Schreiber me at schreibersebastian.de
Fri Jan 6 13:03:19 CET 2017


what about the setting:

config.tx_extbase.features.ignoreAllEnableFieldsInBe = 1


Am 06.01.17 um 12:28 schrieb Alexander Wende:
> Hi,
>
> I have following problem with extbase and TYPO3 6.2. I have an object
> (video) with an relation to an other (page) which is sometimes hidden.
>
> If the page is hidden the page property in the video object is empty.
> This behaviour is correct for the frontend, but in the backend I need
> the relation if the page is hidden.
>
> I know that I can change the querySettings in the repository to
> irgnore the enable fields. But in the model, the relation is build by
> the property mapper and not by the repository. I think the property
> mapper uses the settings from the tca.
> Now I have two solutions for this problem. But both seems to smell.
> Comments, suggestions und improvements are highly required.
>
> Solution 1:
> extend the video model as follow.
> [CODE]
>     public function initializeObject(){
>         $this->overridePageIfEmpty();
>     }
>     
>     protected function overridePageIfEmpty(){
>         if (!$this->page instanceof Page){
>             /** @var ObjectManager $objectManager */
>             $objectManager =
> \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
>             $pageRepository =
> $objectManager->get('FOO\\Bar\Domain\\Repository\\PageRepository');
>             $this->page = $pageRepository->findOneByVideo($this);
>         }
>     }
> [/CODE]
> this uses the repository if property mapper has not field the page
> property. So the repository settings will be used.
> Problem: page is invisible for validation
>
> Solution 2:
> Add condition in the pages 'tca overrides' file.
> [CODE]
> if (TYPO3_MODE === 'BE') {
>     $GLOBALS['TCA']['pages']['ctrl']['enablecolumns'] = array();
> } [/CODE]
>
> Validation works fine with that. But I think this could have unwanted
> side effects.
>
> Did anybody has an better sollution for this problem?
>
> Thanks a lot
> Alex
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc

-- 
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)

Paul Nießen Straße 58
D-50969 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 219 / 5302 / 3123



More information about the TYPO3-project-typo3v4mvc mailing list