Skip to content

Instantly share code, notes, and snippets.

View ftdysa's full-sized avatar

Fred Dysart ftdysa

  • Automox
  • Denver, CO
View GitHub Profile
@niksamokhvalov
niksamokhvalov / phinx-migrate-all.php
Last active March 7, 2018 20:11
Phinx console command for execute migrations of the all shards
<?php
/**
* Console command for Phinx with argument "all" for executed migrations for multiple databases.
*
* Structure directory for migrations and configs:
* ```
* migrations/
* .db1/
* .db2/
* .db3/
@Danack
Danack / batchStrace
Last active February 25, 2020 03:28
Strace all the PHP-FPM
#!/bin/bash
# Prevent strace from abbreviating arguments?
# You want the -s strsize option, which specifies the maximum length of a string to display (the default is 32).
# -etrace=!open means to trace every system call except open. In addition, the special values all and none have the obvious meanings.
#-etrace=!open
#-e trace=!write.
<?php
class PostListController extends Controller
{
private $viewModel;
public function __construct()
{
$this->viewModel = $this->get('view_model.twig');
$this->on('data.post_list_served', array($this, 'listServed'));
@zQueal
zQueal / awesome-php.md
Last active December 16, 2019 18:39 — forked from ziadoz/awesome-php.md
@merk
merk / UserController.php
Last active December 22, 2015 08:19
User View Model
<?php
/**
* This file is part of the Project
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@jmikola
jmikola / SecurityLastActivityListener.php
Created November 11, 2011 21:12
Custom Symfony2 Voter for recent-activity and has-password security checks
<?php
namespace Acme\DemoBundle\Listener;
use Acme\DemoBundle\Security\Authorization\Voter;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@jakzal
jakzal / KernelAwareTest.php
Last active June 27, 2024 16:20
KernelAwareTest
<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
@beberlei
beberlei / MyWebTestCase.php
Created September 17, 2011 12:14
Easily Inject authenticated Symfony User into functional test
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/