[FLOW3-general] IdentityRoutePart does not match

Peter Rauber peter.rauber at werkraum.net
Mon Sep 17 09:57:19 CEST 2012


Hi Bastian,

that does not work, because the article-argument sent in the body is 
completely overwritten by the identifier of the route part. I solved this 
by writing an own RoutePart:

class MyIdentityRoutePart extends \TYPO3\FLOW3\Mvc\Routing\DynamicRoutePart 
{

/**
 * Checks, whether given value can be matched.
 *
 * @param string $value value to match
 * @return boolean TRUE if value could be matched successfully, otherwise 
FALSE.
 * @api
 */  
protected function matchValue($value) {
    
if ($value === NULL || $value === '') {
return FALSE;
}
$this->value = array('__identity' => $value);
return TRUE;
}

The DynamicRoutePart from which I inherit returns the value as a string, 
not an array. In \TYPO3\FLOW3\Mvc\Routing\::route the result-array of the 
Route are merged into the arguments-array. Right there the 
request-arguments (coming from the body) are overwritten. Maybe it should 
be merged the other way (request-arguments into routepart-arguments)?

Regards,
Peter


On Friday, August 31, 2012 4:10:03 PM UTC+2, Bastian Waidelich wrote:
>
> > Now I want to update an Article and send a PUT-Request to the 
> > uri: Mypackage/article/71df811d-**8266-4742-b80f-2bc5eb628b12 
> > The content of the request is 
> > JSON: {article:{name:'newName',otherProperty:'newValue'} 
> > 
> > Is this correct? 
>
> If you update a record, you currently have to specifiy the identifier (= 
> UUID) in the request body, too. Otherwise the identifier in the route 
> will be overwritten (This will be fixed with 1.2 hopefully). 
> So your request should look like: 
>
> Mypackage/article/71df811d-**8266-4742-b80f-2bc5eb628b12 
> JSON: {article:{__identity: '71df811d-**8266-4742-b80f-2bc5eb628b12', 
> name:'newName',otherProperty:'newValue'} 
>
>
> HTH, 
>
>
> -- 
> Bastian Waidelich 
> TYPO3 Core Team Member 
>
> TYPO3 .... inspiring people to share! 
> Get involved: typo3.org 
> _______________________________________________ 
> FLOW3-general mailing list 
> FLOW3-... at lists.typo3.org <javascript:> 
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general 
>


More information about the FLOW3-general mailing list