mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fix folder name
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Form\DataMapper;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Symfony\Component\Form\DataMapperInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
|
||||
class ScopePickerDataMapper implements DataMapperInterface
|
||||
{
|
||||
/**
|
||||
* @var \Chill\MainBundle\Entity\Scope
|
||||
*/
|
||||
private $scope;
|
||||
|
||||
public function __construct(Scope $scope = null)
|
||||
{
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
public function mapDataToForms($data, $forms)
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
if ($this->scope instanceof Scope) {
|
||||
$forms['scope']->setData($this->scope);
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($data instanceof Scope) {
|
||||
$forms['scope']->setData($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function mapFormsToData($forms, &$data)
|
||||
{
|
||||
$forms = iterator_to_array($forms);
|
||||
|
||||
if (isset($forms['scope'])) {
|
||||
if ($this->scope instanceof Scope) {
|
||||
$data = $this->scope;
|
||||
} else {
|
||||
$data = $forms['scope']->getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user