[TYPO3-mvc] update hidden / disabled records

Tim Hengeveld typo3 at litedesigns.nl
Mon Apr 2 15:33:36 CEST 2012


Hi Daniel,

Thanks, i'll give it a try!

Kind regards,
Tim



On 2 apr. 2012, at 15:25, Daniel Schöne <daniel at schoene.it> wrote:

> Hi Tim,
> 
> I think the property mapper does map the hidden user. In a recent project I changed the behavior using a overridden findObjectByUid method:
> 
> /**
> * Custom Property Mapper wich works with disabled proerties (e.g. hidden / deleted).
> *
> */
> class Tx_XYZ_Property_Mapper extends Tx_Extbase_Property_Mapper {
> 
>    /**
>     * Finds an object from the repository by searching for its technical UID.
>     * NOTICE: Instead of the original method this one does NOT respect enable fields
>     *
>     * @param string $dataType the data type to fetch
>     * @param int $uid The object's uid
>     * @return object Either the object matching the uid or, if none or more than one object was found, NULL
>     */
>    // TODO This is duplicated code; see Argument class
>    protected function findObjectByUid($dataType, $uid) {
>        $query = $this->queryFactory->create($dataType);
>        $query->getQuerySettings()->setRespectSysLanguage(FALSE);
>        $query->getQuerySettings()->setRespectStoragePage(FALSE);
>        $query->getQuerySettings()->setRespectEnableFields(FALSE);
>        return $query->matching(
>            $query->equals('uid', intval($uid)))
>            ->execute()
>            ->getFirst();
>    }
> }
> 
> 
> TypoScript setup:
> 
> config.tx_extbase {
>  objects.Tx_Extbase_Property_Mapper.className = Tx_XYZ_Property_Mapper


More information about the TYPO3-project-typo3v4mvc mailing list