Ejemplo n.º 1
0
 /**
  * @param User                $user
  * @param ModerationInterface $moderation
  * @param Collection          $contentCollection
  * @param string              $ipAddress
  * @param bool                $isReverse
  * @param ContentInterface    $source
  * @param ContentInterface    $destination
  */
 public function log(User $user, ModerationInterface $moderation, Collection $contentCollection, $ipAddress, $isReverse = false, ContentInterface $source = null, ContentInterface $destination = null)
 {
     $attributes = ['user_id' => $user->id, 'moderation' => $moderation->getKey(), 'is_reverse' => $isReverse, 'ip_address' => $ipAddress];
     if ($source) {
         $attributes['source_content_type'] = $source->getType();
         $attributes['source_content_id'] = $source->getId();
     }
     if ($destination) {
         $attributes['destination_content_type'] = $destination->getType();
         $attributes['destination_content_id'] = $destination->getId();
     }
     $moderationLog = $this->moderationLogRepository->create($attributes);
     foreach ($contentCollection as $content) {
         $this->moderationLogSubjectRepository->addContentToLog($moderationLog, $content);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param ModerationInterface $moderation
  */
 public function addModeration(ModerationInterface $moderation)
 {
     $this->moderations[$moderation->getKey()] = $moderation;
 }