8000 Feature/updated purchasable schema by mmoreram · Pull Request #1065 · elcodi/elcodi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 30, 2019. It is now read-only.

Feature/updated purchasable schema #1065

Merged
merged 8 commits into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CHANGELOG for 1.0.x
===================

This changelog references the relevant changes done in 2.x.x versions

To get the diff for a specific change, go to
https://github.com/elcodi/elcodi/commit/XXX where XXX is the change hash To
get the diff between two versions, go to
https://github.com/elcodi/elcodi/compare/v2.0.0...v2.0.1

### v2.0.0 (30-01-2016)

Added the new Purchasable schema

#### TL;DR

* A new usable interface called PurchasableInterface has been created
* Using Doctrine CTI (Class Table Inheritance)[http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#class-table-inheritance]
to make more usable the purchasable implementation
* Changed how the Cart is actually using products and variants. Now uses
Purchasables instead of
* Introduced a new Purchasable element called Pack, a set of other purchasables,
including as well other packs

#### Release Log

* [`1924f4a`](https://github.com/elcodi/elcodi/commit/1924f4aa185e6adfc37ea4b9a45f28b7c91b46cb) Updated dev-master in all components (mmoreram)
* [`f6d511b`](https://github.com/elcodi/elcodi/commit/f6d511be76c9b0f2990042a27c7cad764928f893) Updated componsents to work with ^2.0 (mmoreram)
* [`9e093cd`](https://github.com/elcodi/elcodi/commit/9e093cd98392c81f121ffd6217cb7b5b084c36f2) Fixes after rebase with master (mmoreram)
* [`bddfb11`](https://github.com/elcodi/elcodi/commit/bddfb1117d8a62ea71a6d509ac846c983c56dcc1) Fixed some headers (mmoreram)
* [`9d16fcb`](https://github.com/elcodi/elcodi/commit/9d16fcb509e1509a8c8187f762dfa5edac4c30b5) Added Categorizable interface (mmoreram)
* [`665a8a7`](https://github.com/elcodi/elcodi/commit/665a8a715f2c4b28a14046c777ee5865857c1861) Updated and Improved Purchasable Schema map (mmoreram)
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"elcodi/state-transition-machine-bundle": "self.version",
"elcodi/page-bundle": "self.version",
"elcodi/entity-translator-bundle": "self.version",
"elcodi/configuration-bundle": "self.version",
"elcodi/sitemap-bundle": "self.version",
"elcodi/metric-bundle": "self.version",
"elcodi/plugin-bundle": "self.version",
Expand Down Expand Up @@ -126,7 +125,6 @@
"elcodi/state-transition-machine": "self.version",
"elcodi/page": "self.version",
"elcodi/entity-translator": "self.version",
"elcodi/configuration": "self.version",
"elcodi/sitemap": "self.version",
"elcodi/metric": "self.version",
"elcodi/plugin": "self.version",
Expand All @@ -149,7 +147,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.0-dev"
}
},
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions src/Elcodi/Bundle/AttributeBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"mmoreram/simple-doctrine-mapping": "^1.0",
"mmoreram/symfony-bundle-dependencies": "^1.1.1",

"elcodi/core-bundle": "^1.0",
"elcodi/attribute": "^1.0"
"elcodi/core-bundle": "^2.0",
"elcodi/attribute": "^2.0"
},
"require-dev": {
"elcodi/test-common-bundle": "^1.0",
"elcodi/fixtures-booster-bundle": "^1.0",
"elcodi/test-common-bundle": "^2.0",
"elcodi/fixtures-booster-bundle": "^2.0",
"doctrine/data-fixtures": "^1.1",
"phpunit/phpunit": "4.8.19"
},
Expand All @@ -59,7 +59,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.0-dev"
}
}
}
14 changes: 7 additions & 7 deletions src/Elcodi/Bundle/BannerBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
"mmoreram/simple-doctrine-mapping": "^1.0",
"mmoreram/symfony-bundle-dependencies": "^1.1.1",

"elcodi/core-bundle": "^1.0",
"elcodi/language-bundle": "^1.0",
"elcodi/media-bundle": "^1.0",
"elcodi/banner": "^1.0"
"elcodi/core-bundle": "^2.0",
"elcodi/language-bundle": "^2.0",
"elcodi/media-bundle": "^2.0",
"elcodi/banner": "^2.0"
},
"require-dev": {
"elcodi/test-common-bundle": "^1.0",
"elcodi/fixtures-booster-bundle": "^1.0",
"elcodi/test-common-bundle": "^2.0",
"elcodi/fixtures-booster-bundle": "^2.0",
"doctrine/data-fixtures": "^1.1",
"phpunit/phpunit": "4.8.19"
},
Expand All @@ -61,7 +61,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.0-dev"
}
}
}
8 changes: 4 additions & 4 deletions src/Elcodi/Bundle/CartBundle/DataFixtures/ORM/CartData.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ public function load(ObjectManager $manager)

$cartLine1 = $cartLineDirector
->create()
->setProduct($product)
->setProductAmount($product->getPrice())
->setPurchasable($product)
->setPurchasableAmount($product->getPrice())
->setAmount($product->getPrice())
->setQuantity(2)
->setCart($fullCart);

$cartLine2 = $cartLineDirector
->create()
->setProduct($productReduced)
->setProductAmount($productReduced->getPrice())
->setPurchasable($productReduced)
->setPurchasableAmount($productReduced->getPrice())
->setAmount($productReduced->getPrice())
->setQuantity(2)
->setCart($fullCart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Elcodi\Component\Cart\Entity\CartLine:
generator:
strategy: AUTO
fields:
productAmount:
column: product_amount
purchasableAmount:
column: purchasable_amount
type: integer
nullable: false
amount:
Expand All @@ -36,10 +36,10 @@ Elcodi\Component\Cart\Entity\CartLine:
name: cart_id
referencedColumnName: id
nullable: false
productCurrency:
purchasableCurrency:
targetEntity: Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface
joinColumn:
name: product_currency_iso
name: purchasable_currency_iso
referencedColumnName: iso
nullable: false
currency:
Expand All @@ -48,21 +48,9 @@ Elcodi\Component\Cart\Entity\CartLine:
name: currency_iso
referencedColumnName: iso
nullable: false
product:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\ProductInterface
purchasable:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\PurchasableInterface
joinColumn:
name: product_id
referencedColumnName: id
nullable: true
variant:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\VariantInterface
joinColumn:
name: variant_id
referencedColumnName: id
nullable: true
pack:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\PackInterface
joinColumn:
name: pack_id
name: purchasable_id
referencedColumnName: id
nullable: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Elcodi\Component\Cart\Entity\Order:
quantity:
column: quantity
type: integer
productAmount:
column: product_amount
purchasableAmount:
column: purchasable_amount
type: integer
nullable: false
couponAmount:
Expand Down Expand Up @@ -109,10 +109,10 @@ Elcodi\Component\Cart\Entity\Order:
referencedColumnName: iso
nullable: false

productCurrency:
purchasableCurrency:
targetEntity: Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface
joinColumn:
name: product_currency_iso
name: purchasable_currency_iso
referencedColumnName: iso
nullable: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Elcodi\Component\Cart\Entity\OrderLine:
generator:
strategy: AUTO
fields:
productAmount:
column: product_amount
purchasableAmount:
column: purchasable_amount
type: decimal
nullable: false
precision: 10
Expand Down Expand Up @@ -49,10 +49,10 @@ Elcodi\Component\Cart\Entity\OrderLine:
name: order_id
referencedColumnName: id
nullable: false
productCurrency:
purchasableCurrency:
targetEntity: Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface
joinColumn:
name: product_currency_iso
name: purchasable_currency_iso
referencedColumnName: iso
nullable: false
currency:
Expand All @@ -61,21 +61,9 @@ Elcodi\Component\Cart\Entity\OrderLine:
name: currency_iso
referencedColumnName: iso
nullable: false
product:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\ProductInterface
purchasable:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\PurchasableInterface
joinColumn:
name: product_id
referencedColumnName: id
nullable: true
variant:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\VariantInterface
joinColumn:
name: variant_id
referencedColumnName: id
nullable: true
pack:
targetEntity: Elcodi\Component\Product\Entity\Interfaces\PackInterface
joinColumn:
name: pack_id
name: purchasable_id
referencedColumnName: id
nullable: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ services:
arguments:
- '@elcodi.loader.cart_prices'
tags:
- { name: kernel.event_listener, event: cart.onload, method: loadCartProductsAmount, priority: 16 }
- { name: kernel.event_listener, event: cart.onload, method: loadCartPurchasablesAmount, priority: 16 }
- { name: kernel.event_listener, event: cart.onload, method: loadCartTotalAmount, priority: 2 }

elcodi.event_listener.load_cart_purchasables_quantity:
class: Elcodi\Component\Cart\EventListener\LoadCartPurchasablesQuantityEventListener
arguments:
- '@elcodi.loader.cart_purchasable_quantity'
tags:
- { name: kernel.event_listener, event: cart.onload, method: loadCartPurchasablesQuantities, priority: 8 }

elcodi.event_listener.save_cart:
class: Elcodi\Component\Cart\EventListener\SaveCartEventListener
arguments:
Expand Down
3 changes: 0 additions & 3 deletions src/Elcodi/Bundle/CartBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ services:
- '@elcodi.wrapper.currency'
- '@elcodi.converter.currency'

elcodi.loader.cart_purchasable_quantity:
class: Elcodi\Component\Cart\Services\CartPurchasablesQuantityLoader

elcodi.cart_saver:
class: Elcodi\Component\Cart\Services\CartSaver
arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testLoadCartAmounts()
{
$cart = $this->getLoadedCart(2);
$this->assertEquals(3000, $cart
->getProductAmount()
->getPurchasableAmount()
->getAmount()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testLoadCartAmounts()
{
$cart = $this->getLoadedCart(2);
$this->assertEquals(3000, $cart
->getProductAmount()
->getPurchasableAmount()
->getAmount()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Elcodi\Bundle\TestCommonBundle\Functional\WebTestCase;
use Elcodi\Component\Cart\Entity\Interfaces\CartInterface;
use Elcodi\Component\Cart\Entity\Interfaces\CartLineInterface;
use Elcodi\Component\Product\Entity\Interfaces\ProductInterface;
use Elcodi\Component\Product\Entity\Interfaces\PurchasableInterface;

/**
Expand All @@ -45,9 +44,9 @@ abstract class AbstractCartManagerTest extends WebTestCase
protected $cartLine;

/**
* @var ProductInterface
* @var PurchasableInterface
*
* Product
* Purchasable
*/
protected $purchasable;

Expand All @@ -68,7 +67,7 @@ public function setUp()
->get('elcodi.factory.cart_line')
->create()
->setPurchasable($this->purchasable)
->setProductAmount($this->purchasable->getPrice())
->setPurchasableAmount($this->purchasable->getPrice())
->setAmount($this->purchasable->getPrice())
->setQuantity(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected static function loadFixturesBundles()
*/
protected function createPurchasable()
{
return $this->find('product_pack', 2);
return $this->find('purchasable_pack', 10);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected static function loadFixturesBundles()
*/
protected function createPurchasable()
{
return $this->find('product_pack', 1);
return $this->find('purchasable', 9);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected static function loadFixturesBundles()
*/
protected function createPurchasable()
{
return $this->find('product_variant', 1);
return $this->find('purchasable', 6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ public function testCreateOrderFromCartComplex()
$this->find('product', 1),
1
);

$cartManager->addPurchasable(
$cart,
$this->find('product_variant', 1),
$this->find('product_variant', 7),
1
);

$cartManager->addPurchasable(
$cart,
$this->find('product_pack', 1),
$this->find('purchasable_pack', 9),
1
);

Expand Down
Loading
0