Conversation
| $localId = $this->entityMappingStore->getLocalId($entity->getId()); | ||
|
|
||
| if ($localId && !$this->statementsCountLookup->hasStatements($localId)) { | ||
| $this->statementsImporter->importStatements($entity_new); |
| } | ||
| $snakList_new = $statement_new->getQualifiers(); | ||
| foreach ($snakList_new as $key2 => $snak_new) { | ||
| if ($snak_new instanceof PropertyValueSnak) { |
There was a problem hiding this comment.
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.
what you mean by flipping the condition?
There was a problem hiding this comment.
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.
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.
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.
hmm, good point. I think it can stay like this.
|
Ping :) |
| $referencedEntities = $this->getReferencedEntities($entity); | ||
| $this->importEntities($referencedEntities, false); | ||
|
|
||
| $entity_new = $entity; |
There was a problem hiding this comment.
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); |
| } | ||
| $snakList_new = $statement_new->getQualifiers(); | ||
| foreach ($snakList_new as $key2 => $snak_new) { | ||
| if ($snak_new instanceof PropertyValueSnak) { |
There was a problem hiding this comment.
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