Skip to content

Instantly share code, notes, and snippets.

View baldurrensch's full-sized avatar

Baldur Rensch baldurrensch

  • Sourceability LLC
  • Irvine, CA
View GitHub Profile
<?php
// ...
class SessionStorageChain implements \SessionHandlerInterface
{
private $readStorageChain;
private $writeStorageChain;
private $container;
@baldurrensch
baldurrensch / Controller.php
Created October 26, 2012 20:28
Problem getting relations working with HateoasBundle
<?php
// This is just copy pasted in here.
class Controller {
public function getMemberAction($memberId)
{
$country = $this->getDoctrine()->getRepository('HautelookApiBundle:Countries')->find('US');
$serializedCountry = $this->get('serializer')->serialize($country, 'json');
diff --git a/.puppet/modules/hautelook/manifests/init.pp b/.puppet/modules/hautelook/manifests/init.pp
index 19b88fd..46fadb1 100644
--- a/.puppet/modules/hautelook/manifests/init.pp
+++ b/.puppet/modules/hautelook/manifests/init.pp
@@ -69,6 +69,21 @@ class hautelook {
require => Package["memcached"]
}
+ package { "mysql-server":
+ ensure => installed,
@baldurrensch
baldurrensch / LoadProductData.php
Created November 2, 2012 20:21
Sample Fixture
<?php
namespace Acme\DemoBundle\DataFixtures\ORM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Acme\DemoBundle\Entity\Product;
/**
@baldurrensch
baldurrensch / services.xml
Created November 2, 2012 21:55
AbstractAuthenticationListener
<service id="rest.security.authentication.listener" class="Acme\TestBundle\Security\Firewall\RestListener" public="false">
<argument type="service" id="security.context"/>
<argument type="service" id="security.authentication.manager" />
<argument type="service" id="doctrine"/>
<argument type="service" id="event_dispatcher" />
<argument type="service" id="security.authentication.success_handler" />
</service>
@baldurrensch
baldurrensch / PhpassEncoder.php
Created November 18, 2012 17:14
How to use Phpass in Symfony
<?php
namespace Acme\DemoBundle\Security\Service;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
use Hautelook\Phpass\PasswordHash;
/**
* A password encoder that uses Phpass for encoding
@baldurrensch
baldurrensch / HautelookDoctrineExclusionStrategy.php
Created November 20, 2012 21:36
JMS Serializer Exclusion Strategy to limit level of serialization
<?php
namespace Hautelook\ApiBundle\Serializer\Handler;
use JMS\SerializerBundle\Serializer\Exclusion\ExclusionStrategyInterface;
use JMS\SerializerBundle\Metadata\ClassMetadata;
use JMS\SerializerBundle\Metadata\PropertyMetadata;
class HautelookDoctrineExclusionStrategy implements ExclusionStrategyInterface
{
service1:
- option1
service2:
- option2
# I basically want to get this as 'approximately'
array('service1' => array('option1'), 'service2' => array('option2'))
<?php
namespace Hautelook\ApiBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
<?php
namespace Gregwar\CaptchaBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**