Skip to content

Instantly share code, notes, and snippets.

@tatma
tatma / ArticleType.php
Last active Dec 7, 2018
Form Type con configureOptions
View ArticleType.php
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\OptionsResolver\OptionsResolver;
@tatma
tatma / ArticleController.php
Last active Dec 8, 2018
Gestione del submit
View ArticleController.php
<?php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use App\Form\ArticleType;
use App\Entity\Article;
class ArticleController extends Controller
{
/**
@tatma
tatma / ArticleController.php
Last active Dec 7, 2018
Gestione del form nel controller
View ArticleController.php
<?php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use App\Form\ArticleType;
use App\Entity\Article;
@tatma
tatma / ArticleType.php
Last active Nov 27, 2018
Type di Article
View ArticleType.php
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class ArticleType extends AbstractType
@tatma
tatma / Article.php
Last active Dec 8, 2018
Article with getters and setters
View Article.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="articles")
* @ORM\Entity
*/
class Article
View ArticleController.php
<?php
/*
* Contenuto precedente
*/
/**
* @Route("/list", name="list_articles")
*/
public function listArticles()
@tatma
tatma / ArticleController.php
Last active Sep 9, 2018
Creating random articles
View ArticleController.php
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\Article;
class ArticleController extends Controller
@tatma
tatma / Article.php
Last active Dec 8, 2018
Basic Entity (properties, no methods)
View Article.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="articles")
@tatma
tatma / menu.html.twig
Created Aug 18, 2018
Include: creazione del menù
View menu.html.twig
<ul>
<li><a href="{{ path('home') }}">Torna alla home</a></li>
<li><a href="{{ path('who_we_are') }}">Chi siamo</a></li>
<li><a href="{{ path('contact_us') }}">Contattaci</a></li>
</ul>
@tatma
tatma / DefaultController.php
Created Aug 15, 2018
Action delle tre rotte /php, /symfony, /vue
View DefaultController.php
<?php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
/**
* @Route("/php", name="php_page")
You can’t perform that action at this time.