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

Add ReplaceDataContainerValueRector #8

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zoglo
Copy link
Member

@zoglo zoglo commented May 7, 2024

Description

Implements #6

Old:

'config' => [
    'dataContainer' => 'Table,
    'ctable'        => ['tl_child_table'],

New:

'config' => [
    'dataContainer' => DC_Table::class,
    'ctable'        => ['tl_child_table'],

@aschempp
Copy link
Member

aschempp commented May 8, 2024

hmmm… wouldn't this change that string everywhere? Like in templates and thelike?

@zoglo
Copy link
Member Author

zoglo commented May 9, 2024

It would 🤔 This may need to be changed to an own rector that checks for array and/or entry types with the key being dataContainer

@zoglo
Copy link
Member Author

zoglo commented Aug 9, 2024

Been a while @aschempp

image

The newest changes check if it's within an array with the key dataContainer and of type string as the value ;)

@zoglo zoglo changed the title Add rectorConfig to change Table to DC_Table::class Add DataContainerConfigOptionToParameterRector Aug 10, 2024
@zoglo zoglo changed the title Add DataContainerConfigOptionToParameterRector Add ReplaceDataContainerRector Aug 10, 2024
@zoglo zoglo changed the title Add ReplaceDataContainerRector Add ReplaceDataContainerValueRector Aug 12, 2024
@zoglo zoglo marked this pull request as draft August 12, 2024 15:09
@zoglo
Copy link
Member Author

zoglo commented Aug 12, 2024

As discussed with @aschempp, this shouldn't be specific and become a general DCA Rewriter that checks the array keys of TL_DCA and then handle the logic based on the passed arguments.

@rorych
Copy link

rorych commented Oct 9, 2024

Is there any update here? This would be a great help

@zoglo
Copy link
Member Author

zoglo commented Oct 9, 2024

@rorych it's more complex than you would think and took quite some time, this branch is out of date already since it's become a NestedArrayItemValueRector that actually replaces a lot but it's not quite finished yet.
If you wanna see the current progress, you can check out:
https://github.com/zoglo/contao-rector/tree/feature/dc_rewriter

Please mind that it's not even yet at the level to be used in production since it would only replace once but would actually have to replace multiple times in an array / DCA and is just seen as a PoC till all tests and examples would work with it.

Once I change my focus back to contao-rector, I may wake that up again but for now I'm busy with other stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants