/**
* Syncronizes tags from the tagging backend with the contacts storage
* backend, if necessary.
*
* @param array $tags Tags from the tagging backend.
*/
public function synchronizeTags(array $tags)
{
if (!is_null($internaltags = $this->getValue('__internaltags'))) {
$internaltags = unserialize($internaltags);
usort($tags, 'strcoll');
if (array_diff($internaltags, $tags)) {
$GLOBALS['injector']->getInstance('Turba_Tagger')->replaceTags($this->getValue('__uid'), $internaltags, $this->driver->getContactOwner(), 'contact');
}
$this->setValue('__tags', implode(', ', $internaltags));
} else {
$this->setValue('__tags', implode(', ', $tags));
}
}