Skip to content

Instantly share code, notes, and snippets.

View khepin's full-sized avatar

Sebastien Armand khepin

  • San Francisco, USA
View GitHub Profile
<?php
public function friendMessageAction()
{
$form = $this->container->get('form.factory')->create('acme_friend_message');
$form = $form->createView();
return compact('form');
}
acme.form.friend_message:
class: Acme\WhateverBundle\FormType\FriendMessageType
arguments: [@acme.friend_message.form_listener]
tags:
- { name: form.type, alias: acme_friend_message}
acme.friend_message.form_listener:
class: Acme\WhateverBundle\FormSubscriber\UserListener
arguments: [@form.factory, @security.context]
<?php
namespace Acme\WhateverBundle\FormSubscriber;
use Symfony\Component\Form\Event\DataEvent;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Doctrine\ODM\MongoDB\DocumentRepository;
use Symfony\Component\Security\Core\SecurityContext;
<?php
namespace Acme\WhateverBundle\FormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Acme\WhateverBundle\FormSubscriber\UserListener;
class FriendMessageFormType extends AbstractType
{
namespace Acme\DemoBundle\Form\Type;
<?php
use Symfony\Component\Form\AbstractType
use Symfony\Component\Form\FormBuilderInterface;
use Acme\DemoBundle\Form\EventListener\AddNameFieldSubscriber;
class ProductType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
{
# List of all repos we want to clone. (No version number required) because we DL ALL versions
"require": [
"symfony/symfony-standard"
],
# the folder that will hold all of the cloned repos
"repodir":"packages",
# the satis config file to update with all the info
"satisconfig":"satis.json"
}
Form.Views.SomeView = Backbone.View.extend({
events: {
'keypress input': 'submitIfPressedEnter'
},
/**
* Transforms an address to GPS coordinates
*/
submitIfPressedEnter: function(event){
<?php
namespace Acme\CommonBundle\Form\Type;
class GeoPointType extends AbstractType
{
public function __construct($map)
{
$this->map = $map->get('ivory_google_map.map');
}
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="khepin_user_validator.pointcut.class">Khepin\UserValidatorBundle\Aop\Pointcut</parameter>
<parameter key="khepin_user_validator.interceptor.class">Khepin\UserValidatorBundle\Aop\Interceptor</parameter>
</parameters>
<?php
namespace Khepin\UserValidatorBundle\Aop;
use CG\Proxy\MethodInterceptorInterface;
use CG\Proxy\MethodInvocation;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Validator\Validator;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Bundle\FrameworkBundle\Routing\Router;