2017 © Pedro PelĂĄez
 

symfony-bundle surveyjs-bundle

SurveyJs Bundle

image

grelu/surveyjs-bundle

SurveyJs Bundle

  • Monday, November 20, 2017
  • by grelu
  • Repository
  • 3 Watchers
  • 2 Stars
  • 24 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 9 % Grown

The README.md

SurveyJsBundle

SurveyJsBundle is just an integration of surveyjs library in Symfony 3., (*1)

How to

  • Install this bundle : composer require grelu/surveyjs-bundle

Enable the bundle

To start using the bundle, register the bundle in your application's kernel class:, (*2)

// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Grelu\SurveyJsBundle\SurveyJsBundle(),
            // ...
        ];
    }
}

Enable routing

# app/config/routing.yml
surveyJs:
    resource: "@SurveyJsBundle/Controller/"
    type:     annotation

Update schema :

php bin/console doctrine:schema:update --force

Install Assets :

php bin/console assets:install

You must now to extend two class in your AppBundle :

Add Class Survey (to save your surveys ) :

<?php

namespace AppBundle\Entity;

use Grelu\SurveyJsBundle\Entity\Survey as BaseSurvey;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="survey")
 */
class Survey extends BaseSurvey
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
}

Add Class DataSurvey (to save results of surveys)

<?php

namespace AppBundle\Entity;

use Grelu\SurveyJsBundle\Entity\DataSurvey as BaseDataSurvey;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="data_survey")
 */
class DataSurvey extends BaseDataSurvey
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
}

Add class in your config.yml

# SurveyJsBundle config
survey_js:
    survey_class: AppBundle\Entity\Survey
    data_survey_class: AppBundle\Entity\DataSurvey

It's Ok ! This is the list of routes available :

survey_index GET ANY ANY /survey/
survey_new_edit GET|POST ANY ANY /survey/edit/{id}
survey_save POST ANY ANY /survey/save
survey_show GET ANY ANY /survey/show/{id}/number/{number}
survey_data_save POST ANY ANY /survey/data-save, (*3)

Enjoy!, (*4)

The Versions

20/11 2017

dev-master

9999999-dev

SurveyJs Bundle

  Sources   Download

The Requires

 

by Grégory DELANNOY

surveyjs bundle questionnaire

20/11 2017

0.1

0.1.0.0

SurveyJs Bundle

  Sources   Download

The Requires

 

by Grégory DELANNOY

surveyjs bundle questionnaire