Skip to content

Instantly share code, notes, and snippets.

View carlossg00's full-sized avatar

carlossg00 carlossg00

View GitHub Profile
<?php
$builder->add(
$builder->create('Author', 'hidden')
->appendClientTransformer(new EntityToIdTransformer(
new EntityChoiceList($em, 'Name\Space\Author')
))
)
<?php
protected function _editAction(Post $post)
{
$em = $this->get('doctrine.orm.default_entity_manager');
$factory = $this->get('form.factory');
$form = $factory->create(new PostFormType());
$form->setData($post);
if ($this->get('request')->getMethod() === 'POST') {
@elliot
elliot / RedirectRoute.yml
Created February 21, 2011 23:00
Using the redirect controller
default:
pattern: /
defaults: { _controller: FrameworkBundle:Redirect:redirect, route: frontend_index }
interface Symfony\Bundle\FrameworkBundle\Request\ParamConverter\ConverterInterface
{
function convert($value);
function setOption($key, $option);
function getOption($key);
}
<?php
class Article extends Content
{
protected $comments; // a Collection implementation, ArrayCollection or PersistentCollection
// get the ArrayCollection or PersistentCollection
public function getComments()
{
return $this->comments;