This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a) Importing the namespace only | |
<?php | |
use Symfony\Component\Form | |
class ContactForm extends Form\Form | |
{ | |
protected function configure() | |
{ | |
$this->add(new Form\TextField('subject', array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="post" action="..." {{ form.enctype }}> | |
{{ form.errors }} | |
{% for field in form.visible_fields %} | |
{{ field.label('My label') }} | |
{{ field.errors }} | |
{{ field.widget }} | |
The ID of this field is: {{ field.id }} | |
And the value: {{ field.value }} | |
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\ResourceWatcher\ResourceWatcher, | |
Symfony\Component\ResourceWatcher\Event\Event, | |
Symfony\Component\Config\Resource\DirectoryResource, | |
Symfony\Component\Config\Resource\FileResource; | |
$watcher = new ResourceWatcher(); | |
$watcher->track(new DirectoryResource('/some/directory'), function($event) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A simple test script to demonstrate how to find the | |
# "absolute path" at which a script is running. Used | |
# to avoid some of the pitfals of using 'pwd' or hard- | |
# coded paths when running scripts from cron or another | |
# directory. | |
# | |
# Try it out: | |
# run the script from the current directory, then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STYLES = $(wildcard stylesheets/*.styl) | |
CSS = $(STYLES:.styl=.css) | |
COMPRESSED = $(CSS:.css=.min.css) | |
all: $(CSS) | |
style.min.css: $(COMPRESSED) | |
@cat $^ > $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Responsive Design Testing</title> | |
<style> | |
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; } | |
.wrapper { width: 6000px; } | |
.frame { float: left; } | |
h2 { margin: 0 0 5px 0; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# for twitter bootstrap specifically #} | |
{% block field_row %} | |
{% spaceless %} | |
<div class="control-group {% if errors|length > 0 %}error{% endif %}"> | |
{{ form_label(form, label|default(null)) }} | |
<div class="controls"> | |
{{ form_widget(form) }} | |
{{ form_errors(form)}} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TimeoutException extends RuntimeException {} | |
class Timeout | |
{ | |
private $active; | |
public function set($seconds) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p bin sources/{config,twig,sql,lib/{Model,Controller}} web/{css,images,js} tests documentation log | |
chmod 777 log | |
> web/favicon.ico | |
cat > bin/generate_model.php <<"EOF" | |
<?php // bin/generate_model.php | |
$app = require(__DIR__."/../sources/bootstrap.php"); |
OlderNewer