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
| Twig: | |
| <a href="{{ path('_welcome') }}">Home</a> | |
| PHP: | |
| <a href="<?php echo $view['router']->generate('_welcome') ?>">Home</a> | |
| If more complicated route. | |
| 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
| Twig: | |
| {% if app.session.hasFlash('notice') %} | |
| <div class="flash-notice"> | |
| {{ app.session.flash('notice') }} | |
| </div> | |
| {% endif %} | |
| PHP: | |
| <?php if ($view['session']->hasFlash('notice')): ?> | |
| <div class="flash-notice"> |
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
| List: | |
| app.security - The security context. | |
| app.user - The current user object. | |
| app.request - The request object. | |
| app.session - The session object. | |
| app.environment - The current environment (dev, prod, etc). | |
| app.debug - True if in debug mode. False otherwise. | |
| 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
| Twig: | |
| {# src/Acme/ArticleBundle/Resources/Article/list.html.twig #} | |
| {% extends 'AcmeArticleBundle::layout.html.twig' %} | |
| {% block body %} | |
| <h1>Recent Articles<h1> | |
| {% for article in articles %} | |
| {% include 'AcmeArticleBundle:Article:articleDetails.html.twig' with {'article': article} %} | |
| {% endfor %} |
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
| Twig: | |
| <img src="{{ asset('images/logo.png') }}" alt="Symfony!" /> | |
| <link href="{{ asset('css/blog.css') }}" rel="stylesheet" type="text/css" /> | |
| PHP: | |
| <img src="<?php echo $view['assets']->getUrl('images/logo.png') ?>" alt="Symfony!" /> | |
| <link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" type="text/css" /> |
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
| Twig: | |
| {# app/Resources/views/base.html.twig #} | |
| {# ... #} | |
| <div id="sidebar"> | |
| {% render "AcmeArticleBundle:Article:recentArticles" with {'max': 3} %} | |
| </div> | |
| 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
| Twig: | |
| {% javascripts '@AcmeFooBundle/Resources/public/js/*' %} | |
| <script type="text/javascript" src="{{ asset_url }}"></script> | |
| {% endjavascripts %} | |
| {% stylesheets '@AcmeFooBundle/Resources/public/css/*' %} | |
| <link rel="stylesheet" href="{{ asset_url }}" /> | |
| {% endstylesheets %} | |
| 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 app/console cache:clear --env=prod --no-debug |
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
| Create the database: | |
| php app/console doctrine:database:create | |
| Create the entity: | |
| php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text" | |
| Update the entities: | |
| php app/console doctrine:generate:entities Acme/StoreBundle/Entity/Product | |
| php app/console doctrine:generate:entities AcmeStoreBundle | |
| php app/console doctrine:generate:entities Acme |
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 app/console generate:bundle --namespace=Acme/HelloBundle --format=yml |
OlderNewer