[TYPO3-mvc] update hidden / disabled records
Henjo Hoeksma
me at henjohoeksma.nl
Wed Apr 4 10:51:46 CEST 2012
Hi Tim,
for this project I needed the initialize object, but you can make it method
specific of course as well.
The point is I only got it working properly using
both setRespectEnableFields() and setRespectStoragePage().
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 14:56, <typo3 at litedesigns.nl> wrote:
> Hey Henjo,
>
> Thanks for the pointer. But if you use the initializeObject() in a
> Repository, then i guess the hidden / disabled objects will ALWAYS be
> found?
>
> This is not what i want, because i also have a list of all companies on my
> site and only companies which are 'activated' should be visible.
>
> Maybe adding a setter function to the repository would make it more
> flexible (like http://forge.typo3.org/issues/8483#note-3)
>
> Greetings,
> Tim
>
>
> > 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
> >>
> > _______________________________________________
> > 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