Skip to content

updated knplabs/knp-gaufrette-bundle to version that supports symfony3 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Form/DataTransformer/BaseFileToStringTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Form\DataTransformerInterface;
use Vlabs\MediaBundle\Entity\BaseFileInterface;
use Symfony\Component\HttpFoundation\File\File;

/**
* Return the path in the form view data.
Expand All @@ -27,7 +28,7 @@ class BaseFileToStringTransformer implements DataTransformerInterface
*/
public function transform($data)
{
return ($data instanceof BaseFileInterface) ? (string) $data->getPath() : null;
return ($data instanceof BaseFileInterface) ? new File($data->getPath(), false) : null;
}

/**
Expand Down
13 changes: 11 additions & 2 deletions Form/Type/DelFileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

/**
* @author Valentin Ferriere <[email protected]>
Expand Down Expand Up @@ -43,14 +44,22 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
*/
public function getParent()
{
return 'checkbox';
return CheckboxType::class;
}

/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'vlabs_del_file';
}

/**
* Backwards compatability for Symfony < 2.7
*/
public function getName()
{
return $this->getBlockPrefix();
}
}
13 changes: 11 additions & 2 deletions Form/Type/FileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Vlabs\MediaBundle\Form\DataTransformer\BaseFileToStringTransformer;
use Vlabs\MediaBundle\EventListener\BaseFileListener;
use Vlabs\MediaBundle\Handler\HandlerManager;
use Symfony\Component\Form\Extension\Core\Type\FileType as BaseFileType;

/**
* @author Valentin Ferriere <[email protected]>
Expand Down Expand Up @@ -71,14 +72,22 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
*/
public function getParent()
{
return 'file';
return BaseFileType::class;
}

/**
* {@inheritdoc}
*/
public function getName()
public function getBlockPrefix()
{
return 'vlabs_file';
}

/**
* Backwards compatability for Symfony < 2.7
*/
public function getName()
{
return $this->getBlockPrefix();
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"symfony/validator": ">=2.1 | >=2.3",
"imagine/Imagine": "<=0.5",
"doctrine/orm": "*",
"knplabs/knp-gaufrette-bundle": "v0.1.7",
"knplabs/knp-gaufrette-bundle": "^0.3.0",
"symfony/finder": ">=2.1"
},

Expand Down