Skip to content

Instantly share code, notes, and snippets.

View NandoKstroNet's full-sized avatar
🎯
Focusing

Nando Kstro Net NandoKstroNet

🎯
Focusing
View GitHub Profile
@NandoKstroNet
NandoKstroNet / ProductController.php
Created December 6, 2017 21:34
Utilizando templates twig em nosso controller Symfony 4, post sobre templates no Symfony 4 - Blog Code Experts Learning blog.codeexpertslearning.com.br
<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use App\Entity\Product;
class ProductController extends AbstractController
@NandoKstroNet
NandoKstroNet / index.html.twig
Created December 6, 2017 21:39
Template criado no post sobre templates no Symfony 4, da Code Experts Learning - blog.codeexpertslearning.com.br
{% extends 'base.html.twig' %}
{% block body %}
<h1> Produtos </h1>
<hr>
<ul>
{% for p in products %}
<li>
Nome: {{p.name}}
- Preço: R$ {{p.price|number_format(2, ',', '.')}}
# This file is auto-generated during the composer install
parameters:
database_host: 127.0.0.1
database_port: null
database_name: api_sf
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
{
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle",
"APIBundle\\": "src/APIBundle"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
api:
resource: "@APIBundle/Controller/"
type: annotation
prefix: /api
defaults:
_format: json
app:
resource: '@AppBundle/Controller/'
type: annotation
<?php
namespace APIBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
class DefaultController extends Controller
{
@NandoKstroNet
NandoKstroNet / rest-basics.md
Created January 18, 2018 18:35 — forked from alexserver/rest-basics.md
REST basics, Theory, Principles, and examples.

RESTful API know-how

Motivation

I place my learning process in this document with 2 motives:

  1. To have a quick guide whenever I lost the track of knowledge.
  2. To share the knowledge with anyone wants to learn RESTful APIs

1. Before, some theory

@NandoKstroNet
NandoKstroNet / Beer.php
Created February 26, 2018 16:45
Entidade Beer, criada na serie sobre API com Symfony 3.4 da Code Experts Learning
<?php
namespace APIBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Beer
*
* @ORM\Table(name="beers")
@NandoKstroNet
NandoKstroNet / BeerController.php
Created February 26, 2018 18:40
BeerController criado na serie sobre API com Symfony 3.4 da Code Experts Learning
<?php
namespace APIBundle\Controller;
use APIBundle\Entity\Beer;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
/**
@NandoKstroNet
NandoKstroNet / UserType.php
Created March 15, 2018 11:46
Class UserType gerada no post sobre Symfony Maker Bundle 1.2 da Code Experts Learning - https://codeexpertslearning.com.br
<?php
namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class UserType extends AbstractType