Skip to content

Instantly share code, notes, and snippets.

View gzankevich's full-sized avatar

Cat Zankevich gzankevich

  • Zankevich Consulting Ltd
  • London, UK
View GitHub Profile
@gzankevich
gzankevich / DemoTest.php
Created May 15, 2012 08:59
Basic Symfony2/Selenium2 Setup
<?php
// src/Acme/DemoBundle/Tests/Selenium/DemoTest.php
namespace Acme\DemoBundle\Tests\Selenium;
use Acme\DemoBundle\Tests\SeleniumTestCase;
class DemoTest extends SeleniumTestCase
{
officeGeolocator.preUpdate:
class: Phoenix\CRMBundle\Listener\OfficeGeolocator
calls:
- [ setMapit, [@phoenixcrm.mapit] ]
tags:
- { name: doctrine.event_listener, event: preUpdate }
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="folder")
*/
$em = $this->getEntityManager();
$viewing = new Viewing();
$viewing->setMeetingPerson('t');
$viewing->setMeetingPlace('t');
$viewing->setContactNumber('1');
$viewing->setViewingAt(new \DateTime());
$lmo = new LeadMatchingOffice();
class LeadMatchingOfficeViewingsType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('viewings', 'collection', array(
'type' => new ViewingsListType()
))
;
}
$this->get('test.service');
yeilds:
array (size=2)
0 => string 'hello' (length=5)
1 => string 'world' (length=5)
public function whateverAction()
{
$form = $this->createForm(new ViewingReportType($viewings));
$form->bindRequest($this->getRequest());
if($form->isValid()) {
die('valid');
}
test
@gzankevich
gzankevich / AcmeChildBundle.php
Created December 6, 2012 17:35
Bundle inheritance conflicts with extending templates
...
class AcmeChildBundle extends Bundle
{
public function getParent()
{
return 'AcmeParentBundle';
}
}
@gzankevich
gzankevich / gist:5003680
Created February 21, 2013 10:10
Symfony2 + jQuery UI DateTime picker
// in the formtype
->add('my_datetime_field', 'datetime', array(
'widget' => 'single_text',
'required' => true,
))
// using jqueryui + http://trentrichardson.com/examples/timepicker/
$(element).datetimepicker({
dateFormat: 'dd/mm/yy',
timeFormat: 'hh:mm',