PHP code example of webit / doctrine-jms-json

1. Go to this page and download the library: Download webit/doctrine-jms-json 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/ */

    

webit / doctrine-jms-json example snippets


# boostrap.php

use Doctrine\DBAL\Types\Type;
use Webit\DoctrineJmsJson\DBAL\JmsJsonType;
use JMS\Serializer\SerializerBuilder;
use Webit\DoctrineJmsJson\Serializer\Type\DefaultSerializerTypeResolver;

Type::addType('jms_json', 'Webit\DoctrineJmsJson\DBAL\JmsJsonType');

$serializer = SerializerBuilder::create()->build();
// initialize JmsJsonType
JmsJsonType::initialize($serializer, new DefaultSerializerTypeResolver());


interface Slider
{
}

class BannerSet
{
    private $id;
    
    /** Slider */
    private $slider;
    
    /**
     * @return Slider
     */
    public function slider()
    {
        return $this->slider;
    }
    
    /**
     * @param Slider $slider
     */
    public function changeSlider(Slider $slider)
    {
        $this->slider = $slider;
    }
}