Skip to content

Instantly share code, notes, and snippets.

View damienalexandre's full-sized avatar
❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪

Damien Alexandre damienalexandre

❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪
View GitHub Profile
@damienalexandre
damienalexandre / WhateverToolkit.class.php
Created February 16, 2011 10:52
Fix the 250 chars memcached cache key limit on symfony 1
<?php
/**
* Set cache_namespace_callable: [ pouet, generateShortenedCacheKey ] in your settings.yml
* Then the symfony cache key is shortened by MD5
*
* @author dalexandre
* @see sfViewCacheManager::generateCacheKey
* @param sfViewCacheManager $sfViewCacheManager
* @return string
*/
@damienalexandre
damienalexandre / New way to set the encoder.
Created January 23, 2011 15:50
Playing with the Symfony2 serializer
<?php
// Inside your action
$this->serializer = new \Symfony\Component\Serializer\Serializer();
$this->serializer->addNormalizer(new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer());
$this->serializer->setEncoder('xml', new \Symfony\Component\Serializer\Encoder\XmlEncoder());
return $this->createResponse($this->serializer->encode($page, 'xml'), 200, array('Content-Type' => 'application/xml'));
<?php
class Answer extends BaseAnswer
{
public function preSave($event)
{
if ($this->getIsTrue())
{
$q = Doctrine_Query::create()
->update('Answer')