Route Enhancer for sf_event_mgt - typo3

I can't get the list route enhancer working for sf_event_mgt 5.0.1 in my TYPO3 10.4.6 installation. All the other routes seem to work (detail, registration etc.) but list, instead of just linking the list plugin page, generates a link to
/veranstaltungen-1?tx_sfeventmgt_pievent%5Baction%5D=list&tx_sfeventmgt_pievent%5Bcontroller%5D=Event&cHash=19b6ef72f7fdbb2f7bc9269ab3ea3446
I'm using the exact configuration provided in the extension documentation. (except for the page uids of course)
I've also tried adding a plugin route enhancer just for the list action like tx_news used to do, and change the list route to something else than "/" but to no avail.
EventList:
type: Plugin
routePath: '/{#widget_0/currentPage}'
namespace: tx_sfeventmgt_pievent
aspects:
'#widget_0/currentPage':
type: StaticRangeMapper
start: '1'
end: '1000'
as part of the sf_event_mgt config from the documentation:
…
routes:
- { routePath: '/list/{page}', _controller: 'Event::list', _arguments: {'page': '#widget_0/currentPage'} }
…
I didn't bother to check if the argument target is correct here, since the route doesn't work anyway, even without any arguments.
In contrast the route configuration for news works like a charm
NewsList:
type: Plugin
routePath: '/{#widget_0/currentPage}'
namespace: tx_news_pi1
aspects:
'#widget_0/currentPage':
type: StaticRangeMapper
start: '1'
end: '1000'
Help would be appreciated.

I'm the author of sf_event_mgt. I think there might be a problem with you routing configuration, since you define the key of the page aspect to be as #widget_0/currentPage (which includes a slash).
The following configuration should work as expected with the latest version of the extension on TYPO3 10.4.6:
EventPlugin:
type: Extbase
limitToPages: [3,4,5]
extension: SfEventMgt
plugin: Pievent
routes:
- { routePath: '/{page}', _controller: 'Event::list', _arguments: {page: '#widget_0/currentPage'} }
defaultController: 'Event::list'
defaults:
page: '1'
requirements:
page: '\d+'
aspects:
page:
type: StaticRangeMapper
start: '1'
end: '100'

Related

How to use conditions in OpenAPI Generator's Mustache templates?

I'm using OAS3 generator for Java as a Maven plugin to generate POJOs, controllers, delegates etc for my APIs with the Mustache templates from the openapi-generator repository: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache
I'm trying to edit this template so that the "#Controller" annotation is generated only if a condition is met. I've searched for multiple solutions for this and one of them was using "vendorExtensions".
I've made the following contract with x-generateController vendorExtension:
openapi: 3.0.0
info:
title: User API
description: API for user changes
contact:
name: xxx
url: xxx
email: xxx
license:
name: xxx
url: xxx
version: 1.0.0
tags:
- name: user
x-generateController: True
paths:
/users:
...
And then in the Mustache template file I have put the following:
{{#vendorExtensions.x-generateController}}
#Controller("{{classname}}")
{{/vendorExtensions.x-generateController}}
The generator works just fine without this condition but it seems like it doesn't take into account x-generateController. In fact, if I try to just place it as a comment like this:
// {{vendorExtensions.x-generateController}}
I get only "// " and an empty space. I've also tried putting it at the "endpoint level" and not in the "info level" and the problem is the same.
Is there anything more that I should've done in the configuration? Is there any alternative for a condition in the Mustache template?

Routing problem after upgrading from LTS 8 to LTS 9 (RealURL -> Core routing)

After migrating our site from version 8 LTS to version 9 LTS, I have some configuration problems with the routing.
With RealURL we use the fixedPostVars, 'noMatch' => 'bypass'.
For example with this URL
http://Mysite/my-page/mysubpage
?tx_extension[action]=show
&tx_extension[controller]=Researchers
&tx_extension[fullName]=FirstNameWithÉ-LastName
&tx_extension[id]=37
&cHash=f077e6ab99d456c1d0431603186c32cf
We would like to have
http://Mysite/my-page/mysubpage/FirstNameWithC-LastNameWithe/37
For now I can get
http://Mysite/my-page/mysubpage/FirstNameWith%2527-LastName/37
?tx_extension%5Baction%5D=show
&tx_extension%5Bcontroller%5D=Researchers
&cHash=067d606ab30ace24e7cf347bdf89b011
I tried several configurations without success.
So how can I do to hide the controller, the action and the cHash.
Also, how to handle accented characters in URL.
This is my configuration for routeEnhancers
ListResearchers:
type: Plugin
limitToPages:
- 2706
- 2707
routePath: '/{name}/{uid}'
namespace: 'tx_extension'
_arguments:
name: 'fullName'
uid: 'id'
fullName has a too huge value space to be there without requirements/aspects. That will produce ?cHash.
In your case (string), you can use the PersistedAliasMapper or write a custom aspect.
uid will need requirements. (If you want to use it. You could get rid of it with PersistedAliasMapper)

FOSRestBundle routes versioning

I wanted to implement versioning of endpoints for my project.. turns out the FOSRestBundle implementation is not quite clear so I wanted to implement like follow:
Symfony 5.4
FOSRestBundle 3
see below annotation.yaml file:
v2_controllers:
resource: ../../src/Controller/V2/
type: annotation
prefix: /v2
name_prefix: 'api_v2_'
controllers:
resource: ../../src/Controller/
type: annotation
name_prefix: 'api_'
kernel:
resource: ../../src/Kernel.php
type: annotation
when I run this command php bin/console debug:router --show-controllers
I get the following result:
..
..
...
api_offer_list GET ANY ANY /offer-list/{productId}/{pageType}/ App\Controller\V2\OfferListV2Controller::offerListAction()
api_v2_offer_list GET ANY ANY /v2/offer-list/{productId}/{pageType}/ App\Controller\V2\OfferListV2Controller::offerListAction()
...
..
You can see that the new version is also overriding the older endpoint for some weird reasons
and finally here's my fos_rest.yaml config:
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
fos_rest:
param_fetcher_listener: true
Inside the controller directory, you need to create two separate directories, one for v1 and the other for v2 and this should solve the problem.
Controller/
v1/
v2/

flutter auto route build runner error Route must have either a page or a redirect destination

when i add a new route to router.dart and run the build runner i get the
Route must have either a page or a redirect destination
Error
below is my code in router.drat :
#MaterialAutoRouter(
replaceInRouteName: 'Page,Route',
routes: <AutoRoute>[
AutoRoute(
path: '/',
page: SplashPage,
),
AutoRoute(
path: 'signInPage',
name: 'SignInRouter',
page: SignInPage,
),
AutoRoute(
path: 'noteOverviewPage',
name: 'NoteOverviewRouter',
page: NoteOverviewPage,
),
AutoRoute(
path: 'todoFormPage',
name: 'todoFormRouter',
page: TodoFormPage,
),
],
)
class $AppRouter {}
There is also the possibility that you forgot to save the code of your new page (which happened to me). In that case your code might be there but the file is not yet saved so build runner will create this error.
I fix this it, removing and re-import class patch
Make sure that all pages are stateless widgets, not statefull widgets! This weird move helped me. Met this strange problem today, maybe it's bug.

TYPO3 custom aspect and routing not used

I wrote a custom Aspect for better doing better routes in my TYPO3 project. And use it within my config.yaml at the end, configuring the URL-generation for my TXPO3-extension.
...
PsoabillingPlugin:
type: Extbase
extension: Psoabilling
plugin: Pi1
routes:
- routePath: '/banddetail/{bandname}'
_controller: 'Band::showband'
_arguments:
name: bandname
defaultController: 'Band::listyear'
aspects:
bandname:
type: BandAndYearMapper
But, the URLs are not processed. They stay the same as without the configuration.
(btw: the additional configuration for EXT:news above my configuration does work as expected!)
Any thoughts?
Thanx
EnzephaloN
Got it!
I was wrong about the mapping of REPLACEMENT: ARGUMENTFIELD...
The URL-argument is tx_psoabilling[band] and not [name]...
Must be:
...
PsoabillingPlugin:
type: Extbase
extension: Psoabilling
plugin: Pi1
routes:
- routePath: '/banddetail/{bandname}'
_controller: 'Band::showband'
_arguments:
bandname: band
defaultController: 'Band::listyear'
aspects:
bandname:
type: BandAndYearMapper
But sadly now I got a new problem. The cHash is attached to the url and the link does not work because of a cHash-comparsion-error. But thats another post...