This file contains 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 | |
namespace AppBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use AppBundle\Form\DataMapper\UserSettingDataMapper; | |
class UserProfileSettingsType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $build, array $options) |
This file contains 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 | |
namespace AppBundle\Entity; | |
use Symfony\Component\Security\Core\User\UserInterface; | |
class UserSetting | |
{ | |
/** | |
* @var UserInterface |
This file contains 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\HttpFoundation\StreamedResponse; | |
use Symfony\Component\HttpFoundation\File\File; | |
public function streamAction() | |
{ | |
$file = new File('/path/to/largefile.ext'); | |
// in case you need the container | |
$container = $this->container; | |
$response = new StreamedResponse(function() use($container, $file) { |
This file contains 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 | |
namespace Acme\TutorialBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Validator\Validation; | |
use Symfony\Component\Validator\Constraints as Assert; | |
class TestCommand extends ContainerAwareCommand |
This file contains 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 interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$validator = Validation::createValidator(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value) use($validator){ | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); |
This file contains 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 interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value){ | |
$validator = Validation::createValidator(); | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); |
This file contains 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 interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', array($this, 'validateInput')); | |
} | |
public function validateInput($value) | |
{ |
This file contains 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 interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$validator = Validation::createValidator(); | |
$inputValue = $dialog->ask($output, 'Enter some input: '); | |
$errors = $validator->validateValue($inputValue, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \RuntimeException('Input cannot be blank'); |
This file contains 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
# Add a self generated cert to local keychain so we do not get ssl issues when testing, this is used for development | |
# and should only be used on your local box | |
sudo security add-trusted-cert -d -k /Library/Keychains/System.keychain -r trustRoot -p ssl \*.localhost.com.cer |
This file contains 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
Bash oneliner | |
for file in $(git ls-files --other --exclude-standard); do rm "$file"; done | |
Git Clean, does the exact same thing | |
git clean -df |