[TYPO3-mvc] update hidden / disabled records

Henjo Hoeksma me at henjohoeksma.nl
Tue Apr 3 14:28:32 CEST 2012


Hi Tim,

I remember when working on a project with hidden objects I had to include
the RespectStorage method as well next to the respectEnableFields.
Removing this resulted in not retrieving the objects.

My repository looks like this:

class Tx_Hhsubscribe_Domain_Repository_SubscriptionRepository extends
Tx_Extbase_Persistence_Repository {
public function initializeObject(){
 $querySettings =
$this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings');
$querySettings->setRespectEnableFields(FALSE);
 $querySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($querySettings);
 }
}

Hope this helps!

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 Tue, Apr 3, 2012 at 13:11, <typo3 at litedesigns.nl> wrote:

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