Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
xrowkristina committed Jun 29, 2015
1 parent 20cfe88 commit f6ddabc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Component/SyliusDefaultFunctionsOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
class SyliusDefaultFunctionsOverride
{
private $container;
public $eZAPIRepository;
private $entityManager;
private $eventDispatcher;
private $sylius = array();

public function __construct(ContainerInterface $container)
{
$this->container = $container;
$this->eZAPIRepository = $this->container->get('ezpublish.api.repository');
$this->entityManager = $this->container->get('doctrine.orm.entity_manager');
$this->eventDispatcher = $this->container->get('event_dispatcher');
$this->sylius['CartProvider'] = $this->container->get('sylius.cart_provider');
Expand Down Expand Up @@ -123,8 +125,8 @@ public function checkoutOrder(OrderInterface $order, $userData)
$this->entityManager->persist($order);
$this->entityManager->flush();

$this->eventDispatcher->dispatch(SyliusCheckoutEvents::FINALIZE_COMPLETE, new GenericEvent($order));
$this->eventDispatcher->dispatch(SyliusOrderEvents::POST_CREATE, new GenericEvent($order));
#$this->eventDispatcher->dispatch(SyliusCheckoutEvents::FINALIZE_COMPLETE, new GenericEvent($order));
#$this->eventDispatcher->dispatch(SyliusOrderEvents::POST_CREATE, new GenericEvent($order));

return $order;
}
Expand Down Expand Up @@ -207,8 +209,7 @@ private function createNewProductAndVariant($contentId)
*/
public function getEZObjectWithParent($contentId)
{
$eZAPIRepository = $this->container->get('ezpublish.api.repository');
$contentCervice = $eZAPIRepository->getContentService();
$contentCervice = $this->eZAPIRepository->getContentService();
$eZObjectArray = array('contentObject' => $contentCervice->loadContent($contentId));
// Get the parent of eZ product
$reverseRelations = $contentCervice->loadReverseRelations($eZObjectArray['contentObject']->versionInfo->contentInfo);
Expand All @@ -225,8 +226,7 @@ public function getEZObjectWithParent($contentId)
*/
public function getEZObject($contentId)
{
$eZAPIRepository = $this->container->get('ezpublish.api.repository');
$contentCervice = $eZAPIRepository->getContentService();
$contentCervice = $this->eZAPIRepository->getContentService();
return $contentCervice->loadContent($contentId);
}

Expand Down
9 changes: 3 additions & 6 deletions Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,21 @@ public function loadUserByCredentials($username, $password)
// Get client data of the oauth client
$client_id = $this->container->getParameter('oauth_client_id');
$client_secret = $this->container->getParameter('oauth_client_secret');
$this->client->setBaseUrl('http://www.wuv-abo.de.example.com');
$base_url = $this->container->getParameter('oauth_baseurl');
$this->client->setBaseUrl($base_url);
$cookieJar = $this->cookiePlugin->getCookieJar();
// All requests
$requestUrls = array(
'accessToken' => '/oauth/v2/token?client_id='.$client_id.'&client_secret='.$client_secret.'&grant_type=password&username='.$username.'&password='.$password,
'authentication' => '/xrowapi/v1/auth?access_token=%s&grant_type=client_credentials',
'authentication' => '/xrowapi/v1/auth?access_token=%s',
'user' => '/xrowapi/v1/user',
'account' => '/xrowapi/v1/account',
'subscriptions' => '/xrowapi/v1/subscriptions',
);
$oauthToken = $this->container->get('security.context')->getToken();
#$accessTokenString = $this->container->get('session')->get('athash');
#$accessToken = $this->container->get('fos_oauth_server.server')->verifyAccessToken($accessTokenString);
#die(var_dump($eventDispatcher));
if ($oauthToken instanceof AnonymousToken) {
$accessTokenResponse = $this->client->get($requestUrls['accessToken'])->send();
$cookieJar->addCookiesFromResponse($accessTokenResponse);
#$eventDispatcher->dispatch(SyliusCartEvents::ITEM_ADD_INITIALIZE, $event);
$accessTokenJson = $accessTokenResponse->json();
if (isset($accessTokenJson['access_token'])) {
// Set authentication
Expand Down

0 comments on commit f6ddabc

Please sign in to comment.