Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Weaver weaverryan

View GitHub Profile
@weaverryan
weaverryan / CheeseNormalizer.php
Created Jun 30, 2020
inlining children of a self-referencing to an IRI in API Platform
View CheeseNormalizer.php
<?php
namespace App\Serializer\Normalizer;
use App\Entity\CheeseListing;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
@weaverryan
weaverryan / console.php
Last active May 14, 2018
working on console
View console.php
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
set_time_limit(0);
@weaverryan
weaverryan / deets.md
Created Feb 8, 2018
PhpStorm Users with Symfony!
View deets.md

PhpStorm has some AWESOME plugins for Symfony.

To install them:

  1. Open the PhpStorm "Preferences"
  2. Search "Symfony" and select the top-level Plugin menu item
  3. Near the bottom, click the "Browse Repositories" button

Browse Repositories

@weaverryan
weaverryan / Comment.php
Last active Feb 8, 2018
Symfony Demo with make:entity --regenerate --overwrite
View Comment.php
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@weaverryan
weaverryan / test-maker.md
Created Feb 8, 2018
How to help test the new make:entity Command
View test-maker.md
  1. In your composer.json file, add the weaverryan fork:
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/weaverryan/maker-bundle"
        }
    ],
View ProductuController.php
<?php
namespace App\Controller;
use App\Repository\ProdutoRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ProdutoController extends Controller
{
@weaverryan
weaverryan / the_form.html.twig
Last active Jan 13, 2018
fosU registration form
View the_form.html.twig
{# ... #}
{% block body %}
{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register'}}) }}
{{ form_row(form.email, {
attr: { class: 'some-custom-class'}
}) }}
{{ form_row(form.username) }}
{{ form_row(form.plainPassword) }}
<div>
@weaverryan
weaverryan / framework.yml
Last active Jan 7, 2018
different caching
View framework.yml
framework:
# ...
cache:
app: cache.adapter.apcu
# or you could use cache.adapter.redis
# and configure below via
# default_redis_provider: redis://localhost
@weaverryan
weaverryan / details.md
Created Nov 18, 2017
SymfonyCon Hackday Details
View details.md
@weaverryan
weaverryan / CoolStuff.php
Last active Nov 6, 2017
Autowireable & Auto-registered Repository Services in Doctrine 1.8
View CoolStuff.php
<?php
// Coming in DoctrineBundle 1.8: https://github.com/doctrine/DoctrineBundle/pull/727
/* *********************
src/Entity/CoolStuff.php
/* ********************* */
/**
* @ORM\Entity(repositoryClass="App\Repository\CoolStuffRepository")
*/
class CoolStuff
You can’t perform that action at this time.