Passed
Push — master ( f1569f...752413 )
by Aimeos
07:11
created

BasketController::bulkComponentAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2014-2016
6
 * @package symfony
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\ShopBundle\Controller;
12
13
use Symfony\Component\HttpFoundation\Response;
14
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
16
17
/**
18
 * Aimeos controller for basket related functionality.
19
 *
20
 * @package symfony
21
 * @subpackage Controller
22
 */
23
class BasketController extends Controller
24
{
25
	/**
26
	 * Returns the html for the standard basket page.
27
	 *
28
	 * @return Response Response object containing the generated output
29
	 */
30
	public function indexAction()
31
	{
32
		$params = [];
33
		$shop = $this->container->get( 'shop' );
34
35
		foreach( $this->container->getParameter( 'aimeos_shop.page' )['basket-index'] as $name )
36
		{
37
			$params['aiheader'][$name] = $shop->get( $name )->getHeader();
38
			$params['aibody'][$name] = $shop->get( $name )->getBody();
39
		}
40
41
		$response =  $this->render( '@AimeosShop/Basket/index.html.twig', $params );
42
		$response->headers->set('Cache-Control', 'no-store');
43
		return $response;
44
	}
45
46
47
	/**
48
	 * Returns the output of the bulk order component
49
	 *
50
	 * @return Response Response object containing the generated output
51
	 */
52
	public function bulkComponentAction()
53
	{
54
		$client = $this->container->get( 'shop' )->get( 'basket/bulk' );
55
		$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
56
57
		return new Response( (string) $client->getBody() );
58
	}
59
60
61
	/**
62
	 * Returns the output of the basket mini component
63
	 *
64
	 * @return Response Response object containing the generated output
65
	 */
66
	public function miniComponentAction()
67
	{
68
		$client = $this->container->get( 'shop' )->get( 'basket/mini' );
69
		$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
70
71
		$response = new Response( (string) $client->getBody() );
72
		$response->headers->set('Cache-Control', 'no-store');
73
		return $response;
74
	}
75
76
77
	/**
78
	 * Returns the output of the basket related component
79
	 *
80
	 * @return Response Response object containing the generated output
81
	 */
82
	public function relatedComponentAction()
83
	{
84
		$client = $this->container->get( 'shop' )->get( 'basket/related' );
85
		$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
86
87
		$response = new Response( (string) $client->getBody() );
88
		$response->headers->set('Cache-Control', 'no-store');
89
		return $response;
90
	}
91
92
93
	/**
94
	 * Returns the output of the basket standard component
95
	 *
96
	 * @return Response Response object containing the generated output
97
	 */
98
	public function standardComponentAction()
99
	{
100
		$client = $this->container->get( 'shop' )->get( 'basket/standard' );
101
		$this->container->get( 'twig' )->addGlobal( 'aiheader', (string) $client->getHeader() );
102
103
		$response = new Response( (string) $client->getBody() );
104
		$response->headers->set('Cache-Control', 'no-store');
105
		return $response;
106
	}
107
}
108