Access some method (like urlFor)

Hi (again),

I’ve another question with the access of the method.

On the service, I generate a table… the date came from my api, and in this table, I’ve some links.
Actually, I need to write manually the link… (like /users/data/3).
What I would like to do is in my class, create the link with “urlFor”.
But can’t access this method in my “repository”.

Is there a way to get it working ?

To bypass the manual way, I created a route with like this : /users/data[/{id}].
I create the url for this without the ID and then with JS I add the ID at the end of my href.

Thanks.

To do this, you could inject an instance of Slim\Interfaces\RouteParserInterface into your service and generate the URLs with the data you fetched via the repository.

1 Like

When I do it I get a new error :
Too few arguments to function App\Membres\Repository\Membres::__construct(),

In fact, I’ve two Classes
The first one => who get the data with PDO and I use "fetchAll(PDO::FETCH_CLASS, OtherClass::class)

The second one => who’s working on the data when the data are retrieve.

And it’s on this second class that I need to work with the url of my member.

Don’t know If it’s clear ?