[TYPO3-mvc] update hidden / disabled records

typo3 at litedesigns.nl typo3 at litedesigns.nl
Tue Apr 3 13:11:47 CEST 2012


Hi List,

I've taken a look at the solution offered by Daniel, but i can only get
this to work if i can get to the UID of my FrontendUser. But i can't
because Extbase immediately tries to convert the uid to an object.

Therefore i have chosen to implement my own solution where i save the
FrontendUser.uid redundantly in a separate field (fe_user_id) in my
Company model as an integer. This way i can get the UID value of the
FrontendUser and can create a query with setRespectEnableFields(FALSE) to
find the disabled FrontendUser.

Hope this helps someone :)

Kind regards,
Tim


> 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
> _______________________________________________
> 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