Skip to content

Instantly share code, notes, and snippets.

View pjedrzejewski's full-sized avatar

Paweł Jędrzejewski pjedrzejewski

View GitHub Profile
@pjedrzejewski
pjedrzejewski / config.yml
Created September 30, 2014 12:15
Sylius scrutinizer config
filter:
paths:
- 'src/*'
excluded_paths:
- 'src/Sylius/Bundle/*/spec/*'
- 'src/Sylius/Bundle/*/Tests/*'
- 'src/Sylius/Component/*/spec/*'
- 'src/Sylius/Component/*/Tests/*'
- 'app/*'
tools:
Feature: Custom text printing
In order to sell more customized products
As a Customer
I want to customize my product
Background:
Given there is default currency configured
Scenario: Entering custom text when adding product to the cart
Given there is a product "Nike T-Shirt", which cost is 10 EUR
$form = $this->get('sylius.assortment.form.category');
$category = $this->get('sylius.assortment.manager')->createCategory();
$form->bind($this->get('request'), $category);
if ($form->isValid()) {
$this->get('sylius.assortment.manager')->addCategory($category);
return new RedirectResponse($this->get('router')->generate('homepage'));
}
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.assortment.form.category.class">Sylius\AssortmentBundle\Form\CategoryForm</parameter>
<parameter key="sylius.assortment.form.category.name">form.category</parameter>
/**
* Products.
*
* @OneToMany(targetEntity="Sylius\AssortmentBundle\Entity\Product", mappedBy="category")
*/
protected $products;
/* ... */
public function __construct()
@pjedrzejewski
pjedrzejewski / gist:1217751
Created September 14, 2011 20:50
Test gist.
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@pjedrzejewski
pjedrzejewski / gist:1223256
Created September 16, 2011 21:51
Overriding templates in Symfony2, gist #1.
<?php
// ...
return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array(
'form' => $form->createView(),
'theme' => $this->container->getParameter('fos_user.template.theme'),
));
@pjedrzejewski
pjedrzejewski / gist:1223280
Created September 16, 2011 22:08
Overriding templates in Symfony2, gist #2.
<?php
// src/Application/Bundle/UserBundle.
namespace Application\Bundle\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ApplicationUserBundle extends Bundle
{
public function getParent()
{
@pjedrzejewski
pjedrzejewski / gist:1225223
Created September 18, 2011 16:11
Symfony2 configuration processor, gist #3.
<?php
namespace Sylius\Bundle\ThemingBundle\Packager;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Yaml\Yaml;
// ...
$processor = new Processor();
@pjedrzejewski
pjedrzejewski / gist:1225175
Created September 18, 2011 15:40
Symfony2 configuration processor, gist #1.
# Super cool theme by super cool theme designer.
# (c) Super cool theme designer
theme:
name: "Super cool theme."
version: 0.1.2
description: |
The coolest theme evar.