Skip to content

Instantly share code, notes, and snippets.

View Decorator.py
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:
View services.yml
#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" ]
View GetOneBy.php
<?php
public function findFirstCompany()
{
$query = $this->getEntityManager()->createQueryBuilder();
$query->select('c')
->from('CompanyBundle:Company', 'c')
->orderBy('c.createdAt', 'DESC');
View Example.php
<?php
namespace Test\Job\CompanyBundle\Entity\Listener;
use Test\CoreBundle\Entity\Address;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Symfony\Component\DependencyInjection\ContainerInterface;
View ParserFactory.php
<?php
class JobToEstimateParser
{
/** @var JobRepository $jobRepository */
private $jobRepository;
/** @var CompanyRepository $companyRepository */
private $companyRepository;
View CreateHandler.php
<?php
namespace FA\Shared\CoreBundle\Handler;
use Doctrine\Common\Persistence\ObjectManager;
use FA\Shared\CoreBundle\Form\Handler\FormHandler;
class CreateHandler extends NewHandler
{
View FormHandler.php
<?php
namespace FA\Shared\CoreBundle\Form\Handler;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormFactory;
class FormHandler
View formTest.php
<?php
protected function setUp()
{
$this->factory = Forms::createFormFactoryBuilder()
->addExtensions($this->getExtensions())
->addTypeExtension(new AutoCompleteExtension())
->getFormFactory();
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
View User.php
<?php
/**
* @return string
* @VirtualProperty
* @SerializedName("foo")
*/
public function getFoo()
{
if ($this->getEmailMask())
View example.php
<?php
class Contact {
protected $maskEmail;
protected $email;
public function checkEmail()
{
if ($this->maskEmail){