-
Notifications
You must be signed in to change notification settings - Fork 18
Issue16 #41
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
base: master
Are you sure you want to change the base?
Issue16 #41
Conversation
$localId = $this->entityMappingStore->getLocalId($entity->getId()); | ||
|
||
if ($localId && !$this->statementsCountLookup->hasStatements($localId)) { | ||
$this->statementsImporter->importStatements($entity_new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go with $camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, ok
} | ||
$snakList_new = $statement_new->getQualifiers(); | ||
foreach ($snakList_new as $key2 => $snak_new) { | ||
if ($snak_new instanceof PropertyValueSnak) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can shorten this our by flipping the condition and doing a continue inside or extract this to a method. This is too much indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what you mean by flipping the condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean something like this:
if (!$snak_new instanceof PropertyValueSnak) {
confinute;
}
$referencedEntities = $this->getReferencedEntities($entity); | ||
$this->importEntities($referencedEntities, false); | ||
|
||
$entity_new = $entity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed to clone the entity and do the changes? Why not changing them in the place? Sorry if it sounds stupid, I don't know the full context here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a good php programmer. I'm not sure if this is working because the coded iterates over the statements and they are changed. If you think this can work I will try ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, good point. I think it can stay like this.
Ping :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was a bit busy .... and first time I'm doing this .... should I make a new pull request with the changes you proposed?
$referencedEntities = $this->getReferencedEntities($entity); | ||
$this->importEntities($referencedEntities, false); | ||
|
||
$entity_new = $entity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a good php programmer. I'm not sure if this is working because the coded iterates over the statements and they are changed. If you think this can work I will try ....
$localId = $this->entityMappingStore->getLocalId($entity->getId()); | ||
|
||
if ($localId && !$this->statementsCountLookup->hasStatements($localId)) { | ||
$this->statementsImporter->importStatements($entity_new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, ok
} | ||
$snakList_new = $statement_new->getQualifiers(); | ||
foreach ($snakList_new as $key2 => $snak_new) { | ||
if ($snak_new instanceof PropertyValueSnak) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what you mean by flipping the condition?
All good, no I think a commit on top of this would be enough. |
This solves issue 16, i.e. a problem that occurs when adding statement that contain a unit. The idea of the fix is to replace the units urls with the corresponding local urls. My IDE somehow reformatted the whole file. if this is a problem I can change that.
Salut
D063520