Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with symfony/string for better strings manipulation #1316

Open
norberttech opened this issue Jan 1, 2025 · 5 comments
Open

Integration with symfony/string for better strings manipulation #1316

norberttech opened this issue Jan 1, 2025 · 5 comments
Milestone

Comments

@norberttech
Copy link
Member

norberttech commented Jan 1, 2025

That would be very helpful integration from text processing point of view.

Library: https://github.com/symfony/string

It should be pretty straightforward since we would just need to create a scalar function for each of the methods string methods.

I think we can make it a part of TextAdapter, just put all scalar functions inside of it.
All those functions should be also added to TextAdapter DSL functions, with a text_ prefix.
Those functions should exist in the src/core/etl/src/Flow/ETL/Function namespace and be part of the core ETL.

We don't even need to create for them dedicated DSL functions (as they can only operate on string), what we can do is simply expose them through src/core/etl/src/Flow/ETL/Function/ScalarFunctionChain.php so they would all be available through ref()->xxxx

Documentation: How to create scalar function

@norberttech norberttech moved this to In Progress in Roadmap Jan 1, 2025
@norberttech norberttech added this to the 0.11.0 milestone Jan 1, 2025
@stloyd
Copy link
Member

stloyd commented Jan 1, 2025

How does it differ from Symfony String?

@norberttech
Copy link
Member Author

Interesting, I would need to go through entire APIs of both libs to understand which one provides more value.
symfony/string comes with some dependencies, that's
one thing.
However to provide more text manipulation options we should also take a look at https://github.com/voku/portable-utf8

So the question is what makes more sense, portable-ascii + portable-utf8 or symfony/string?

@norberttech
Copy link
Member Author

I asked GitHub copilot which one we should use and he said symfony/string but without any good justification 😅 I wouldn't trust it, comparing the APIs - that's what we
need to do first

@norberttech norberttech moved this from In Progress to Todo in Roadmap Jan 3, 2025
@norberttech
Copy link
Member Author

https://symfony.com/doc/current/string.html#methods-to-change-case just noticed that symfony/string can also replace an existing case converting dependency.
So I guess we have our answer about which library to use

@norberttech norberttech changed the title Integration with Portable Ascii Integration with symfony/string for better strings manipulation Jan 5, 2025
@norberttech
Copy link
Member Author

This is an example of how easy it is to create Scalar Functions: #1337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants