[TYPO3-mvc] Configure addRecordTypeConstraint?

Henjo Hoeksma me at henjohoeksma.nl
Sat Nov 12 15:02:12 CET 2011


Hi Georg,

for my own extension I tried out something funny to load a different model
when using another extension + a setting in the cofiguration of the news
extension: I load the configuration array and based on that decided which
model to actually use.

In my Domain/Model/Item.php is set the following code:

// get extension configuration
$confArr =
unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['hhnews']);


if ($confArr['useYoutube']) {
require_once ('ItemWithYoutube.php');
} else {
require_once ('ItemNormal.php');
}

Other than it feels dirty I have found no drawback in using it so far.

On the other hand you could create one model and make the distinction of
what the TCA Form is showing based on your forms type setting. But I think
that's what you had at first?

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Sat, Nov 12, 2011 at 11:03, Georg Ringer <typo3 at ringerge.org> wrote:

> Hi,
>
> got it working. still i would love to turn it off too
>
> works with
>
> ------------------------
>        persistence {
>                classes {
>                        Tx_News_Domain_Model_News {
>                                subclasses {
>                                        0 = Tx_News_Domain_Model_News
>                                        1 =
> Tx_News_Domain_Model_NewsExternal
>                                        2 =
> Tx_News_Domain_Model_NewsInternal
>                                }
>                        }
>
>                        Tx_News_Domain_Model_NewsExternal {
>                                mapping {
>                                        recordType = 1
>                                        tableName =
> tx_news_domain_model_news
>                                }
>                        }
>
>                        Tx_News_Domain_Model_NewsInternal {
>                                mapping {
>                                        recordType = 2
>                                        tableName =
> tx_news_domain_model_news
>                                }
>                        }
>                }
>        }
> ---------------------
>
> georg
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list