Skip to content

Instantly share code, notes, and snippets.

View weaverryan's full-sized avatar

Ryan Weaver weaverryan

View GitHub Profile
@weaverryan
weaverryan / Makefile
Created May 5, 2011 11:36
Example sphinx configuration for rendering the symfony docs
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build -c .
PAPER =
BUILDDIR = build
SOURCE = source
@weaverryan
weaverryan / todos.markdown
Created May 12, 2011 12:28
Pending Service Container Documentation Todos

The service container chapter itself is probably (at least) nearly content-complete. There are many other things (and service options) still to cover on the topic, however, and I think these should become a part of an advanced service container cookbook article:

  • property injection
  • file
  • calls
  • factory_class, factory_method
  • configurator
  • abstract
  • synthetic
  • scopes
@weaverryan
weaverryan / Renders-with-no-spaces.html
Created June 12, 2011 23:50
Why I love Twig - space control, loop index
<a href="{{ upload_path('post_photo', photo.photoPath) }}" class="last not_first_row">
@weaverryan
weaverryan / 8a38a6f_style_4.css
Created July 30, 2011 18:09
Assetic relative path setup
/* /app_dev.php/css/8a38a6f_style_4.css */
/* The cssrewrite filter physically adds an extra ../ so that the this resolves correctly in dev */
body{
background: url(../../images/bodyBg.png) repeat-x;
font-family: Georgia, "Times New Roman", Times, serif;
}
@weaverryan
weaverryan / .gitignore
Created August 3, 2011 19:32
sample Symfony2 .gitignore
web/bundles/
app/bootstrap*
app/cache/*
app/logs/*
vendor/
app/config/parameters.ini
@weaverryan
weaverryan / actions.class.php
Created August 5, 2011 15:14
Example "Container" in symfony 1.4
<?php
class mySoapActions extends sfActions
{
public function executeSomething(sfWebRequest $request)
{
$soapApi = $this->getSoapAPI();
// do something with it
}
@weaverryan
weaverryan / play.php
Created August 5, 2011 15:35
Example of a "play" script in Symfony 1.4
<?php
// web/play.php
// guarantee that we're load and proud
ini_set('display_errors', true);
error_reporting(E_ALL);
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
@weaverryan
weaverryan / behat
Created September 4, 2011 21:03
Small script to easily execute behat inside Symfony2
#!/bin/sh
# A little shortcut script for executing Behat inside a Symfony2 project
#
# Configure behat in Symfony2 per the following instructions and then place this in the root of your project
# http://docs.behat.org/bundle/index.html
#
# Example Usage:
# ./behat @BlogBundle
@weaverryan
weaverryan / DefaultController.php
Created September 26, 2011 14:46
Example of validating a scalar value in Symfony2
<?php
// .. other things
use Symfony\Component\Validator\Constraints\Email;
class DefaultController
{
public function someAction()
{
@weaverryan
weaverryan / form.html.twig
Created December 2, 2011 16:02
Form theming for error class on row
{% block field_row %}
{% spaceless %}
<div {{ errors|length > 0 ? 'class="error"' : '' }}>
{{ form_label(form, label|default(null)) }}
{{ form_errors(form) }}
{{ form_widget(form) }}
</div>
{% endspaceless %}
{% endblock field_row %}