Skip to content

Instantly share code, notes, and snippets.

View wouterj's full-sized avatar

Wouter de Jong wouterj

View GitHub Profile
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
provider: db_provider
anonymous: ~
<?php
class PostController extends Controller
{
public function showAction($slug, $_template)
{
$post = $this->someBackend->findBySlug($slug);
return $this->render($_template, ['post' => $post]);
}

Every request, get the current logged in user (on the PC, no idea how they plan to implement this) and authenticate this user in the app (creating a new user if it doesn't exists yet).

<?php
// ...
class MailLogger implements LoggerInterface
{
private $mailer;
public function __construct(MailerInterface $mailer)
{
$this->mailer = $mailer;
$ composer require --no-update symfony/framework-bundle "~2.3.3|~2.6.6"
$ composer require --no-update symfony/symfony "*"
$ composer update -q
$ composer show -i
...
symfony/framework-bundle v2.6.12
symfony/symfony          v2.8.1
[PDOException]
SQLSTATE[HY000]: General error: 1 no such table: phpcr_workspaces
Exception trace:
() at C:\sf-world\cmf\standard-edition\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php:691
PDO->prepare() at C:\sf-world\cmf\standard-edition\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php:691
Doctrine\DBAL\Connection->executeQuery() at C:\sf-world\cmf\standard-edition\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php:419
Doctrine\DBAL\Connection->fetchColumn() at C:\sf-world\cmf\standard-edition\vendor\jackalope\jackalope-doctrine-dbal\src\Jackalope\Transport\DoctrineDBAL\Client.php:409

How to Prepare Your Bundle for Symfony 3

Symfony 3 is a major version update of Symfony. This means that code working on Symfony 2 applications might not work on Symfony 3. In order to update your bundles for Symfony 3, you need to make sure that your bundle doesn't use any of the removed features without also using the replacement. This guide will teach you how to add Symfony 3 support to your bundle and it'll also give you some practical tips to support both Symfony 2 and 3.

<?php
namespace App;
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Input\InputArgument;
aferrandini/urlizer 1.0.0 Library for urlizer
burgov/key-value-form-bundle 1.3.1 A form type for managing key-value pairs
cocur/slugify 1.4.x-dev 05f00fa Converts a string into a slug.
container-interop/container-interop 1.1.0 Promoting the interoperability of container objects (DIC, SL, etc.)
doctrine/annotations dev-master f25c8aa Docblock Annotations Parser
doctrine/cache dev-master eb8a736 Caching library offering an object-oriented API for many cache backends
doctrine/collections dev-master 866e100 Collections Abstraction library
doctrine/common dev-master 69e04b3 Common Library for Doctrine projects
doctrine/data-fixtures dev-master a02f0e7 Data Fixtures for all Doctrine Object Managers
doctrine/dbal 2.4.x-dev 4845507 Database Abstraction Layer
<?php
require 'vendor/autoload.php';
$dom = new DOMDocument();
$dom->loadHTML(<<<EOH
<!doctype html>
<td>
<div class="iaconbox">
<a title="magnet">Hello!</a>