Skip to content

Instantly share code, notes, and snippets.

class Filters(object):
def __init__(self, types=[], query=None):
self.types = types
self.query = query
def __call__(self, *args, **kwargs):
for type in self.types:
try:
func = getattr(Filters, type)
except AttributeError:
#Services
job.company_bundle.quickbooks.parser.company_to_customer:
class: David\Job\CompanyBundle\Quickbooks\Parser\CompanyToCustomerParser
arguments: [ "@doctrine.orm.entity_manager", "@templating" ]
job.company_bundle.quickbooks.parser.estimate_to_job:
class: David\Job\CompanyBundle\Quickbooks\Parser\EstimateToJobParser
arguments: [ "@doctrine.orm.entity_manager", "@templating", "@job.company_bundle.quickbooks.parser.company_to_customer" ]
<?php
public function findFirstCompany()
{
$query = $this->getEntityManager()->createQueryBuilder();
$query->select('c')
->from('CompanyBundle:Company', 'c')
->orderBy('c.createdAt', 'DESC');
<?php
namespace Test\Job\CompanyBundle\Entity\Listener;
use Test\CoreBundle\Entity\Address;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Symfony\Component\DependencyInjection\ContainerInterface;
<?php
class JobToEstimateParser
{
/** @var JobRepository $jobRepository */
private $jobRepository;
/** @var CompanyRepository $companyRepository */
private $companyRepository;
<?php
namespace FA\Shared\CoreBundle\Handler;
use Doctrine\Common\Persistence\ObjectManager;
use FA\Shared\CoreBundle\Form\Handler\FormHandler;
class CreateHandler extends NewHandler
{
<?php
namespace FA\Shared\CoreBundle\Form\Handler;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormFactory;
class FormHandler
<?php
protected function setUp()
{
$this->factory = Forms::createFormFactoryBuilder()
->addExtensions($this->getExtensions())
->addTypeExtension(new AutoCompleteExtension())
->getFormFactory();
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
<?php
/**
* @return string
* @VirtualProperty
* @SerializedName("foo")
*/
public function getFoo()
{
if ($this->getEmailMask())
<?php
class Contact {
protected $maskEmail;
protected $email;
public function checkEmail()
{
if ($this->maskEmail){