This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Silex\WebTestCase; | |
class RoutesTest extends WebTestCase | |
{ | |
public function createApplication() | |
{ | |
return require ROOT_DIR . '/app.php'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Silex\Application; | |
$app = new Application(); | |
$app['debug'] = true; | |
$app->get('/', function(Application $app){ | |
return $app['twig']->render('index.html.twig'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fruits = ['laranja', 'maçã', 'banana', 'pera']; | |
$i = 0; | |
while($i < count($fruits)) { | |
print $fruits[$i] . PHP_EOL; | |
$i++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fruits = ['laranja', 'maçã', 'banana', 'pera']; | |
$i = 0; | |
do { | |
print $fruits[$i] . PHP_EOL; | |
$i++; | |
} while ($i < count($fruits)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fruits = ['laranja', 'maçã', 'banana', 'pera']; | |
for($i = 0; $i < count($fruits); $i++) { | |
print $fruits[$i] . PHP_EOL; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fruits = ['laranja', 'maçã', 'banana', 'pera']; | |
foreach($fruits as $key => $fruit) { | |
print $key . ' - ' . $fruit . PHP_EOL; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository") | |
*/ | |
class Product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository") | |
*/ | |
class Product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>{% block title %}Welcome!{% endblock %}</title> | |
{% block stylesheets %}{% endblock %} | |
</head> | |
<body> | |
{% block body %}{% endblock %} | |
{% block javascripts %}{% endblock %} |