Skip to content

Instantly share code, notes, and snippets.

View codecowboy's full-sized avatar

Luke Mackenzie codecowboy

  • UK
View GitHub Profile
@codecowboy
codecowboy / gist:1109764
Created July 27, 2011 16:35
catch EM error
if (isset($date)) {
$trainingSession = new TrainingSession();
$user = $this->get('security.context')->getToken()->getUser();
$trainingSession->setUser($user);
$date = date_create_from_format('d/m/y', $date);
$trainingSession->setDate($date);
$trainingSession->setStatus('pending');
$trainingSession->setType('gym');
$em = $this->getDoctrine()->getEntityManager();
services:
gymloop_profile_type:
class: Gymloop\CoreBundle\Form\ProfileFormType
tags:
- { name: form.type, alias: gymloop.profile.type }
arguments: [%fos_user.model.user.class%]
gymloop_profile_handler:
class: Gymloop\CoreBundle\Form\ProfileFormHandler
scope: request
@codecowboy
codecowboy / gist:1082246
Created July 14, 2011 10:44
ProfileFormType
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@codecowboy
codecowboy / gist:1078933
Created July 12, 2011 20:40
edit template
{# this can be used to get an individual form value {{form.username.get('value') } #}
{#classes like input_large are from the formalize framework - see formalize.css#}
<form class="grid_6 prefix_1" action="{{ path('fos_user_profile_edit') }}" {{ form_enctype(form) }} method="POST" class="fos_user_profile_edit">
{{ form_errors(form) }}
<div class="grid_2 alpha">
{{ form_label(form.first_name, 'First Name: ') }}
</div>
@codecowboy
codecowboy / gist:1078906
Created July 12, 2011 20:31
Updated PorfileFormHandler
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@codecowboy
codecowboy / gist:1078873
Created July 12, 2011 20:13
User Entity Class
<?php
namespace Gymloop\CoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
@codecowboy
codecowboy / gist:1078869
Created July 12, 2011 20:12
ProfileFormHandler
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@codecowboy
codecowboy / gist:1078865
Created July 12, 2011 20:11
ProfileFormType
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@codecowboy
codecowboy / gist:1078862
Created July 12, 2011 20:10
config.yml
parameters:
date_format: m/D/y
services:
gymloop_profile_type:
class: Gymloop\CoreBundle\Form\ProfileFormType
tags:
- { name: form.type, alias: gymloop.profile.type }
arguments: [%fos_user.model.user.class%]
@codecowboy
codecowboy / gist:1056837
Created June 30, 2011 18:19
User Entity Class
<?php
namespace Gymloop\CoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")