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

Rework the model collector #540

Merged
merged 21 commits into from
Feb 28, 2022
Merged

Conversation

baumannsven
Copy link
Member

Rework the model collector.

  • Allow the hierarchical has a parent data provider
  • Add new method for search the parent model from a hierarchical model
  • Add the missing search over the configured inverse filter

@baumannsven baumannsven added this to the 2.2.0 milestone Jul 18, 2020
@baumannsven baumannsven requested review from discordier and zonky2 July 18, 2020 11:02
@baumannsven baumannsven changed the base branch from master to release/2.2.0 July 18, 2020 11:02
Copy link
Member

@discordier discordier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some remarks that need to be resolved first.

src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
Copy link
Member

@discordier discordier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more remarks influenced by #541

src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
@zonky2 zonky2 changed the title [RTM] Rework the model collector Rework the model collector Apr 15, 2021
Copy link
Member

@dmolineus dmolineus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@discordier @baumannsven I reviewed this pull request, added some unit tests to understand the behaviour and changes some implementations based on discussions with @discordier.

src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
@dmolineus dmolineus requested a review from discordier November 22, 2021 11:20
Copy link
Member

@discordier discordier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some remarks.

Additionally, we discussed on Mumble that we want to have github actions in here before merging.

src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
src/Controller/ModelCollector.php Outdated Show resolved Hide resolved
use ContaoCommunityAlliance\DcGeneral\DataDefinition\ModelRelationship\RootConditionInterface;
use ContaoCommunityAlliance\DcGeneral\EnvironmentInterface;
use ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException;
use ContaoCommunityAlliance\DcGeneral\Test\TestCase;
use Generator;
use function func_get_args;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSR-12 requires an empty line here to separate blocks what does the current style say?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7826ab3

use ContaoCommunityAlliance\DcGeneral\DataDefinition\ModelRelationship\RootConditionInterface;
use ContaoCommunityAlliance\DcGeneral\EnvironmentInterface;
use ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException;
use ContaoCommunityAlliance\DcGeneral\Test\TestCase;
use Generator;
use function func_get_args;
use function var_dump;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the forgotten debug import.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7826ab3


$collector = new ModelCollector($environment);

$this->assertSame($expected, $collector->searchParentOfIn($model, $candidates));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call static method via self::assertSame()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7826ab3

);

$collector = new ModelCollector($environment);
$this->assertSame($expected, $collector->searchParentOfIn($model, $grandParents));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call static method via self::assertSame()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7826ab3

);

$collector = new ModelCollector($environment);
$this->assertSame($expected, $collector->searchParentOf($model));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call static method via self::assertSame()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7826ab3

@dmolineus dmolineus force-pushed the feature/rework_model_collector branch from d7b4ed8 to ba51701 Compare February 21, 2022 15:08
@dmolineus
Copy link
Member

As discussed with @discordier I do not limit searchParentOf to a model of the default provider (459ee4f) anymore. As discussed with @baumannsven I dropped the searchParentOfRootModel method (5e99407). Feel free to add it in #541 again if really required.

@zonky2 zonky2 requested review from zonky2 and discordier February 23, 2022 16:14
Copy link
Contributor

@zonky2 zonky2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested in MM 2.2 - works fine

I can delete attributes without error.

@discordier discordier linked an issue Feb 28, 2022 that may be closed by this pull request
@baumannsven
Copy link
Member Author

@dmolineus @discordier @zonky2

How is the state of this PR?

@zonky2
Copy link
Contributor

zonky2 commented Feb 28, 2022

wie schon geschrieben: @dmolineus ist fertig, @zonky2 hat Livetest gemacht und Anmerkungen von @discordier wurden eingepflegt...

@baumannsven baumannsven merged commit 5c240cb into release/2.2.0 Feb 28, 2022
@zonky2 zonky2 deleted the feature/rework_model_collector branch May 16, 2022 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on delete MM attribute
4 participants