Skip to content

Commit

Permalink
Fix Asset\Service::copyContents()
Browse files Browse the repository at this point in the history
  • Loading branch information
blankse authored and dvesh3 committed Apr 6, 2022
1 parent 157afa1 commit e649598
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions models/Asset/Service.php
Expand Up @@ -161,13 +161,12 @@ public function copyAsChild($target, $source)
* @param Asset $target
* @param Asset $source
*
* @return mixed
* @return Asset
*
* @throws \Exception
*/
public function copyContents($target, $source)
{

// check if the type is the same
if (get_class($source) != get_class($target)) {
throw new \Exception('Source and target have to be the same type');
Expand All @@ -179,8 +178,7 @@ public function copyContents($target, $source)
}

$target->setUserModification($this->_user ? $this->_user->getId() : 0);
$newProps = Element\Service::cloneMe($source->getProperties());
$target->setProperties($newProps);
$target->setProperties($source->getProperties());
$target->save();

return $target;
Expand Down

0 comments on commit e649598

Please sign in to comment.