[TYPO3-mvc] Extbase: Edit hidden records in FE

Helmut Hummel helmut.hummel at typo3.org
Wed May 21 17:52:31 CEST 2014


Hi Matthew,

On 08.05.14 07:58, Matthew Colton wrote:

> The hidden records can be listed by using the following in the find
> method of the repository:
> $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
> $query->getQuerySettings()->setEnableFieldsToBeIgnored(array('disabled'));
>
> But there is no explicit call for a repository method in the editAction.
> Which repository method is called?
>
> The following exception is thrown when a user calls the editAction:
>
> #1297759968: Exception while property mapping at property path "":Object
> with identity "4" not found.
>
> The number "4" is the UID of the record.

there are two ways you can fix this.

First (and maybe easiest) would be to use an integer as method parameter 
for your edit action and then fetching the model yourself by using the 
according repository method.

Secondly you can write your own type converter which is triggered only 
for your domain models and let it convert the integer to a domain object 
which will then passed to your edit action.

A bit more details:
With the rewritten poperty mapping so called TypeConverters are used to 
map (request) source types to action method types. The error message you 
quoted above is thrown by the PersistentObjectConverter which simply 
does a $this->persistenceManager->getObjectByIdentifier($identity, 
$targetType); to fetch the object, which in turn respects the enable fields.

Your own type converter could use a repository method that also 
retrieves hidden objects.
Creating a type converter (and registering it in ext_localconf) is quite 
easy, however it could get a bit tricky when it comes to security 
considereations as the type converter would used every time objects of 
that type are converted, which means also in a showAction. Depending on 
what you want and need regarding security, you may need to add 
configuration possibilities to your type converter (see the provided 
converters as example) to be able to act differently for different actions.


HTH

Kind regards,
Helmut

-- 
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list