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

Entity listeners are now processed by exporters #5864

Closed

Conversation

tPl0ch
Copy link
Contributor

@tPl0ch tPl0ch commented Jun 8, 2016

The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

Again there are some test cases failing but I cannot see how they
are related.

The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

Again there are some test cases failing but I cannot see how they
are related.
@grimskin
Copy link

grimskin commented Jun 8, 2016

+1

2 similar comments
@akucherenko
Copy link

+1

@yablokomoloko
Copy link

+1

@Ocramius
Copy link
Member

Ocramius commented Jun 8, 2016

+1-ing issues serve no purpose besides making me want to archive email notifications: don't do it, please.

@@ -82,6 +82,16 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
}
}

if (0 !== count($metadata->entityListeners)) {
Copy link
Member

Choose a reason for hiding this comment

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

To be moved to a private method

@@ -389,6 +389,27 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
}
}

if (0 !== count($metadata->entityListeners)) {
Copy link
Member

Choose a reason for hiding this comment

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

To be moved to one or multiple private methods

@@ -214,6 +214,23 @@ public function exportClassMetadata(ClassMetadataInfo $metadata)
$array['lifecycleCallbacks'] = $metadata->lifecycleCallbacks;
}

if (0 !== count($metadata->entityListeners)) {
Copy link
Member

Choose a reason for hiding this comment

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

To be moved to one or multiple private methods

$array['entityListeners'][$entityListener['class']] = null;
}

if (isset($entityListener['method'])) {
Copy link
Member

Choose a reason for hiding this comment

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

Are there scenarios where 'method' is not defined?

foreach ($entityListenerConfig as $entityListener) {
$class = $entityListener['class'];
$method = $entityListener['method'];
$lines[] = "\$metadata->addEntityListener('$event', '$class', '$method');";
Copy link
Member

Choose a reason for hiding this comment

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

Please don't interpolate. Use sprintf() instead. Also, please do use var_export() on values that end up being in PHP code.

* @Table(name="cms_users",options={"engine"="MyISAM","foo"={"bar"="baz"}})
* @EntityListeners({
* "Doctrine\Tests\ORM\Tools\Export\UserListener",
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the ::class syntax here?

@tPl0ch
Copy link
Contributor Author

tPl0ch commented Jul 31, 2017

@Ocramius I have been browsing my open PRs (of which I have forgotten half of them). I would actually finish this if you think it makes sense and would be worth it.

@Ocramius
Copy link
Member

@tPl0ch this is more a question for @guilhermeblanco, who just rewrote most of the metadata stuff.

@guilhermeblanco is this kind of exporter API still existing in 3.x?

@guilhermeblanco
Copy link
Member

@Ocramius it does, since this is part of convert mapping support (transition from yml to xml for example)

tPl0ch added a commit to tPl0ch/doctrine2 that referenced this pull request Aug 1, 2017
The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

This PR originates from doctrine#5864,
I was overwhelmed by the amount of conflicts I had to resolve so I
started anew on a clean master HEAD.
@tPl0ch
Copy link
Contributor Author

tPl0ch commented Aug 1, 2017

@guilhermeblanco The sheer amount of conflicts drove me creating a new PR for this hotfix: #6593

I'll close this one here.

@tPl0ch tPl0ch closed this Aug 1, 2017
@tPl0ch tPl0ch deleted the feature-entity-listeners-export branch August 1, 2017 10:18
@Ocramius Ocramius self-assigned this Aug 3, 2017
tPl0ch added a commit to tPl0ch/doctrine2 that referenced this pull request Aug 14, 2017
The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

This PR originates from doctrine#5864,
I was overwhelmed by the amount of conflicts I had to resolve so I
started anew on a clean master HEAD.
tPl0ch added a commit to tPl0ch/doctrine2 that referenced this pull request Aug 14, 2017
The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

This PR originates from doctrine#5864,
I was overwhelmed by the amount of conflicts I had to resolve so I
started anew on a clean master HEAD.

Squashed commits:

- Code review aftermath
- Add even more return type declarations
- Added `return null` to methods declared with nullable return types
tPl0ch added a commit to tPl0ch/doctrine2 that referenced this pull request Aug 15, 2017
The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

This PR originates from doctrine#5864,
I was overwhelmed by the amount of conflicts I had to resolve so I
started anew on a clean master HEAD.

Squashed commits:

- Code review aftermath
- Add even more return type declarations
- Added `return null` to methods declared with nullable return types
- Removed unneeded docblocks when types are self-explanatory
Ocramius added a commit that referenced this pull request Aug 16, 2017
…pe changes

That's still to be considered a BC break, since child classes are broken if incompatible.

Sorry @tPl0ch :-(
Ocramius added a commit that referenced this pull request Aug 16, 2017
Ocramius added a commit that referenced this pull request Aug 16, 2017
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.

6 participants