/** * Clone a multimedia object. * * @param MultimediaObject $src * @return MultimediaObject */ public function cloneMultimediaObject(MultimediaObject $src) { $new = new MultimediaObject(); $new->setI18nTitle($src->getI18nTitle()); $new->setI18nSubtitle($src->getI18nSubtitle()); $new->setI18nDescription($src->getI18nDescription()); $new->setI18nLine2($src->getI18nLine2()); $new->setI18nKeyword($src->getI18nKeyword()); $new->setCopyright($src->getCopyright()); $new->setLicense($src->getLicense()); // NOTE: #7408 Specify which properties are clonable $new->setProperty("subseries", $src->getProperty("subseries")); $new->setProperty("subseriestitle", $src->getProperty("subseriestitle")); $new->setProperty("clonedfrom", $src->getId()); foreach ($src->getTags() as $tag) { $tagAdded = $this->tagService->addTagToMultimediaObject($new, $tag->getId(), false); } foreach ($src->getRoles() as $embeddedRole) { foreach ($embeddedRole->getPeople() as $embeddedPerson) { $new->addPersonWithRole($embeddedPerson, $embeddedRole); } } $new->setSeries($src->getSeries()); if ($broadcast = $src->getBroadcast()) { $new->setBroadcast($broadcast); $this->dm->persist($broadcast); } $new->setPublicDate($src->getPublicDate()); $new->setRecordDate($src->getRecordDate()); $new->setStatus(MultimediaObject::STATUS_BLOQ); $this->dm->persist($new); $this->dm->flush(); return $new; }