Skip to content

Instantly share code, notes, and snippets.

View craue's full-sized avatar

Christian Raue craue

View GitHub Profile
@craue
craue / gist:2134052
Created March 20, 2012 10:49
sending a download with custom filename in Symfony2
return new Response(
$content,
200,
array(
'Content-Type' => $mimeType,
'Content-Disposition' => sprintf('attachment; filename="%s"', $filename),
)
);
@craue
craue / gist:1446863
Created December 8, 2011 12:33
custom labels for Symfony2 repeated field
<div>
{{ form_label(form.myField.first, '1st label') }}
{{ form_errors(form.myField) }}
{{ form_widget(form.myField.first) }}
</div>
<div>
{{ form_label(form.myField.second, '2nd label') }}
{{ form_widget(form.myField.second) }}
</div>
@craue
craue / gist:1391209
Created November 24, 2011 12:11
body for an email which will be stripped when sent with SwiftMailer
Mail will be stripped due to the length of THIS line and the dot.
Apparently, this line will not be sent due to the exact length of the previous line, the trailing dot and two newlines, no matter which kind of newlines (Windows/UNIX) will be used.
@craue
craue / entities.php
Created November 2, 2011 21:24
OneToOne relationship showing an issue with empty `$timespans` if no invoices exist for the timespans, concerning https://github.com/doctrine/doctrine2/pull/180
class Company {
/**
* @var Timespan[]
* @ORM\OneToMany(targetEntity="Timespan", mappedBy="company", cascade={"persist", "remove"})
*/
protected $timespans;
}
class Timespan {
/**