Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>{% block title %}Zombie Process{% endblock %}</title>
</head>
<body>
<h1>{% block main_title %}{% endblock %}</h1>
{% block content %}{% endblock %}
@tatma
tatma / menu.html.twig
Created August 18, 2018 10:26
Include: creazione del menù
<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 / ArticleController.php
Last active September 6, 2018 14:46
List articles
<?php
/*
* Contenuto precedente
*/
/**
* @Route("/list", name="list_articles")
*/
public function listArticles()
@tatma
tatma / ArticleController.php
Last active September 9, 2018 08:51
Creating random articles
<?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 / ArticleType.php
Last active November 27, 2018 12:50
Type di Article
<?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 / ArticleController.php
Last active December 7, 2018 18:23
Gestione del form nel controller
<?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 December 7, 2018 18:23
Form Type con configureOptions
<?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 / Article.php
Last active December 8, 2018 12:44
Article with getters and setters
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="articles")
* @ORM\Entity
*/
class Article
@tatma
tatma / Article.php
Last active December 8, 2018 12:45
Basic Entity (properties, no methods)
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="articles")
@tatma
tatma / ArticleController.php
Last active December 8, 2018 12:46
Gestione del submit
<?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
{
/**