application icon indicating copy to clipboard operation
application copied to clipboard

LinkGenerator: extract interface

Open PavelJurasek opened this issue 4 years ago • 3 comments

  • feature
  • BC break? no
  • doc PR: should add note to https://github.com/nette/docs/blob/doc-3.1/en/creating-links.texy?

Since LinkGenerator is final, it would be nice if it had its own interface so that it can be replaced with own implementation.

PavelJurasek avatar Jan 14 '21 16:01 PavelJurasek

What is the interface for? Replace it with your own implementation.

dg avatar Jan 15 '21 10:01 dg

Right, I can change service application.linkGenerator to whatever class I want, but it won't solve the problem with 3rd party packages that are typehinted to Nette\Application\LinkGenerator. That leads me to conclusion, that the PR should be reworked to:

  • create ILinkGenerator interface
  • create alias LinkGenerator for ILinkGenerator to keep BC
  • rename current class implementation, DefaultLinkGenerator or similar

PavelJurasek avatar Jan 19 '21 11:01 PavelJurasek

@PavelJurasek I'll save this as a beautiful argument when someone wonders why I'm removing the letter I from the interface names. :-)

dg avatar Jan 19 '21 12:01 dg