passh
passh
Reputation Top 1%
Pascual Muñoz Galián
7 Snippets  (120th place)
Published
1 Channel
Created
6 Channels
Following
187 points  (162nd place)
Reputation
Junior Code Generator
Serious Code Generator
Junior Publisher
Serious Publisher
Junior Trend Maker
Junior Autobiographer
Senior Autobiographer
Master Autobiographer
Serious Famous Coder
Junior Wise Coder

Recent Snippets See all snippets by passh

public by passh  3425  1  5  0

MIG , map , import and generate.

//MAPEAMOS
./console doctrine:mapping:convert xml ../src/vendor/Bundle/Resources/config/doctrine/metadata/orm --from-database -f            

//IMPORTAMOS
 ./console doctrine:mapping:import BlogBundle yml

//GENERAMOS ENTIDADES.            
./console doctrine:generate:entities BlogBundle
            
;

public by passh  3618  1  4  0

security.yml from MYSQL , login from mysql

# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:

    encoders:
        BlogBundle\Entity\Users:
            algorithm: bcrypt
            cost: 4
    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        our_db_provider:
            entity:
                class: BlogBundle:user
                property: email
              

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~
            provider: our_db_provider
            form_login:
                    login_path: /login
                    check_path: /login_check
            logout:
                    path: /logout
                    target: /login
            
;

public by passh  10529  10  4  1

HTML TWIG TEMPLATE BASIC

basic twig html template
{# HTML TEMPLATE TWIG TEMPLATE BASIC by Passh#}
<!DOCTYPE HTML>

<html lang="es">
	<body>

			<head>
					<meta charset="utf-8" />
					<title>
							{% block titulo %} 
								HTML TWIG TEMPLATE
							{%endblock%}
					</title>
			</head>
	</body>
	<footer>by Passh</footer>
</html>
;

public by passh  3599  0  4  1

for each objet symfony twig template

<ul>
	{% for entrada  in entradas %}
		<li>{{ entrada.getTitle()|e }}</li>
	{% else %}
		<li><em>Entrada no encontrada</em></li>
	{% endfor %}
</ul>
;

public by passh  3439  1  5  0

foreach ENTITY in a REPO

<?php

namespace lacueva\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use lacueva\BlogBundle\Entity\Entries;

class DefaultController extends Controller
{
    public function indexAction()
    {

		$em = $this->getDoctrine()->getManager();
		$entry_repo = $em->getRepository('BlogBundle:Entries');
		$entries = $entry_repo->findAll();
		
		$e = new \lacueva\BlogBundle\Entity\Entries;
		foreach ($entries as $e)
		{
			echo $e->getTitle();
		}
		die();
		
		
		 //       return $this->render('BlogBundle:Default:index.html.twig');
    }
}                        
;