SymfonyComponentTranslationCatalogueMergeOperation

Merge operation between two catalogues as follows: all = source * target = {x: x * source * x * target} new = all * source = {x: x * target * x * source} obsolete = source * all = {x: x * source * x * source * x * target} = * Basically, the result contains messages from both catalogues.

Defined (1)

The class is defined in the following location(s).

/vendor/symfony/translation/Catalogue/MergeOperation.php  
  1. class MergeOperation extends AbstractOperation 
  2. /** 
  3. * {@inheritdoc} 
  4. */ 
  5. protected function processDomain($domain) 
  6. $this->messages[$domain] = array( 
  7. 'all' => array(),  
  8. 'new' => array(),  
  9. 'obsolete' => array(),  
  10. ); 
  11.  
  12. foreach ($this->source->all($domain) as $id => $message) { 
  13. $this->messages[$domain]['all'][$id] = $message; 
  14. $this->result->add(array($id => $message), $domain); 
  15. if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { 
  16. $this->result->setMetadata($id, $keyMetadata, $domain); 
  17.  
  18. foreach ($this->target->all($domain) as $id => $message) { 
  19. if (!$this->source->has($id, $domain)) { 
  20. $this->messages[$domain]['all'][$id] = $message; 
  21. $this->messages[$domain]['new'][$id] = $message; 
  22. $this->result->add(array($id => $message), $domain); 
  23. if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { 
  24. $this->result->setMetadata($id, $keyMetadata, $domain);