setCreated example

$this->mediaService->delete($media->getPath());
            $this->mediaService->write($newFileName$fileContent);
            $this->modelManager->getConnection()->update('s_articles_img', [
                'extension' => $newExtension,
            ][
                'media_id' => $media->getId(),
            ]);
        }

        $media->setExtension($this->getExtension($file));
        $media->setFileSize(filesize($filePath));
        $media->setCreated(new DateTime());

        if ($media->getType() === Media::TYPE_IMAGE) {
            $imageSize = getimagesize($filePath);

            if ($imageSize) {
                $media->setWidth($imageSize[0]);
                $media->setHeight($imageSize[1]);
            }

            $media->removeThumbnails();

            
$name = $name . '.' . $ext;
        $path = $this->load($link$name);
        $name = pathinfo($path, PATHINFO_FILENAME);
        $file = new UploadedFile($path$link);

        $media = new MediaModel();

        $media->setAlbumId($albumId);
        $media->setFile($file);
        $media->setName($name);
        $media->setDescription('');
        $media->setCreated(new DateTime());
        $media->setUserId(0);

        /** @var Album|null $album */
        $album = $this->getManager()->find(Album::class$albumId);
        if (!$album) {
            // Cleanup temporary file             $this->deleteTmpFile($file);
            throw new CustomValidationException(sprintf('Album by id %s not found', $albumId));
        }

        $media->setAlbum($album);

        
/** @var Album|null $album */
        $album = $this->get('models')->find(Album::class$albumId);

        if (!$album) {
            $this->View()->assign(['success' => false, 'message' => 'Invalid album id passed']);

            return;
        }

        $media->setAlbum($album);
        $media->setDescription('');
        $media->setCreated(new DateTime());

        $identity = $this->get('auth')->getIdentity();

        if ($identity !== null) {
            $media->setUserId($identity->id);
        } else {
            $media->setUserId(self::FALLBACK_USER_ID);
        }

        $this->Response()->headers->set('content-type', 'text/plain');

        
$newBackup = false;
            /** @var QueueModel|null $queue */
            $queue = $entityManager->find(QueueModel::class$queueId);
            if (!$queue) {
                throw new RuntimeException(sprintf('Queue with ID %s not found', $queueId));
            }
        } else {
            $newBackup = true;
            $queue = new QueueModel('product');
            $queue->setFilterString($filterString);
            $queue->setOperations(json_encode($operations));
            $queue->setCreated(new DateTime());
            $queue->setActive(false);
            $queue->setInitialSize($totalCount);

            $entityManager->persist($queue);
            $entityManager->flush();

            $queueId = $queue->getId();
        }

        $this->getBackupResource()->create($results$operations$newBackup$queue->getCreated() ? $queue->getCreated()->getTimestamp() : time());

        
Home | Imprint | This part of the site doesn't use cookies.