Skip to content

Instantly share code, notes, and snippets.

View pjedrzejewski's full-sized avatar

Paweł Jędrzejewski pjedrzejewski

View GitHub Profile
@pjedrzejewski
pjedrzejewski / gist:1240954
Created September 25, 2011 18:46
Easy categorizing with Symfony2, gist #2.
<?php
namespace Application\Bundle\AssortmentBundle\Entity;
use Sylius\Bundle\CatalogBundle\Entity\Category as BaseCategory;
class Category extends BaseCategory
{
protected $products;
@pjedrzejewski
pjedrzejewski / gist:1240959
Created September 25, 2011 18:53
Easy categorizing with Symfony2, gist #3.
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Bundle\AssortmentBundle\Entity\Category" table="sylius_assortment_category">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
@pjedrzejewski
pjedrzejewski / gist:1240962
Created September 25, 2011 18:57
Easy categorizing with Symfony2, gist #4.
<?php
namespace Application\Bundle\AssortmentBundle\Entity;
use Sylius\Bundle\CatalogBundle\Model\CategoryInterface;
use Sylius\Bundle\AssortmentBundle\Entity\Product as BaseProduct;
class Product extends BaseProduct
{
protected $category;
@pjedrzejewski
pjedrzejewski / gist:1240967
Created September 25, 2011 19:00
Easy categorizing with Symfony2, gist #5.
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Bundle\AssortmentBundle\Entity\Product" table="sylius_assortment_product">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
@pjedrzejewski
pjedrzejewski / gist:1241008
Created September 25, 2011 19:24
Easy categorizing with Symfony2, gist #6.
<?php
namespace Application\Bundle\AssortmentBundle\Form\Type;
use Sylius\Bundle\AssortmentBundle\Form\Type\ProductFormType as BaseProductFormType;
use Symfony\Component\Form\FormBuilder;
class ProductFormType extends BaseProductFormType
{
public function buildForm(FormBuilder $builder, array $options)
@pjedrzejewski
pjedrzejewski / gist:2049871
Created March 16, 2012 12:30
Purge before scenario.
<?php
/**
* @BeforeScenario
*/
public function purgeDatabase()
{
$em = $this->getEntityManager();
$purger = new ORMPurger($em);
<?php
if (
!$this->isOauthExists()
&& ('oauth' === $driver
|| (isset($fetcherConfig['options']['method']) && 'oauth' === $fetcherConfig['options']['method']))
) {
throw new \InvalidArgumentException('You should install and enable InoriTwitterBundle');
}
UserBundle_users_list:
   pattern:  /users/{page}.{_format}
   defaults: { _controller: UserBundle:Users:list, page: 1, _format: html }
   requirements:
      _format:  html
@pjedrzejewski
pjedrzejewski / ItemResolver.php
Last active December 12, 2015 06:29
Adding different item types to cart.
<?php
namespace App\Bundle\AppBundle\Resolver;
use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\CartBundle\Model\CartItemInterface;
use Sylius\Bundle\CartBundle\Resolver\ItemResolverInterface;
use Sylius\Bundle\CartBundle\Resolver\ItemResolvingException;
use Symfony\Component\HttpFoundation\Request;
@pjedrzejewski
pjedrzejewski / ItemResolver.php
Created February 12, 2013 20:18
Adding domains and hosting services.
<?php
namespace App\Bundle\AppBundle\Resolver;
use App\Bundle\AppBundle\Entity\Domain;
use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\CartBundle\Model\CartItemInterface;
use Sylius\Bundle\CartBundle\Resolver\ItemResolverInterface;
use Sylius\Bundle\CartBundle\Resolver\ItemResolvingException;
use Symfony\Component\HttpFoundation\Request;