prepareFilePath example

$params = $this->prepareMediaData($params);

        $media = new MediaModel();
        $media->fromArray($params);
        $attribute = new MediaAttribute();

        if (isset($params['attribute']) && \is_array($params['attribute'])) {
            $attribute->fromArray($params['attribute']);
        }
        $media->setAttribute($attribute);

        $path = $this->prepareFilePath($media->getPath()$media->getFileName());
        $media->setPath($path);

        $violations = $this->getManager()->validate($media);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->getManager()->persist($attribute);
        $this->getManager()->persist($media);
        $this->flush();

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