PHP code example of kunicmarko / simple-configuration-bundle

1. Go to this page and download the library: Download kunicmarko/simple-configuration-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kunicmarko / simple-configuration-bundle example snippets


$bundles = array(
    // ...
    new KunicMarko\SimpleConfigurationBundle\SimpleConfigurationBundle(),
);


namespace YourBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use KunicMarko\SimpleConfigurationBundle\Entity\AbstractConfigurationType;
use Sonata\AdminBundle\Form\FormMapper;
use Symfony\Component\Form\Extension\Core\Type\DateType;

class NewType extends AbstractConfigurationType
{
    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="date", nullable=true)
     */
    private $date;

    public function setDate(?\DateTime $date) : self
    {
        $this->date = $date;

        return $this;
    }

    public function getDate() : ?\DateTime
    {
        return $this->date;
    }

    public function getValue() : ?\DateTime
    {
        return $this->getDate();
    }

    /**
     * {@inheritDoc}
     */
    public function getTemplate() : string
    {
        //return 'SonataAdminBundle:CRUD:list_string.html.twig'; can also be used 
        
        return 'SimpleConfigurationBundle:CRUD:list_field_date.html.twig';
    }

    /**
     * {@inheritDoc}
     */
    public function generateFormField(FormMapper $formMapper) : void
    {
        $formMapper->add('date', DateType::class, ['