Skip to content

Commit

Permalink
Merge pull request #7 from EaDesgin/feature/2172-adding-all-feautres
Browse files Browse the repository at this point in the history
Feature/2172 adding all feautres
  • Loading branch information
eadesignro authored Apr 29, 2018
2 parents 0d2b14b + 6626ddf commit 675cbf5
Show file tree
Hide file tree
Showing 14 changed files with 382 additions and 311 deletions.
5 changes: 2 additions & 3 deletions Block/Account/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ public function __construct(
public function customerKey()
{
$session = $this->session;
$isLoggedIn = $session->isLoggedIn();
$customerId = $session->getCustomerId();

$searchCriteriaBuilder = $this->searchCriteria;
$searchCriteria = $searchCriteriaBuilder->addFilter(
'customer_id',
10
$customerId
)->create();
$customerKey = $this->customerAuthRepository->getList($searchCriteria);
$items = $customerKey->getItems();

return $items;
}
}
}
46 changes: 28 additions & 18 deletions Block/Account/Packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Eadesigndev\ComposerRepo\Block\Account;

use Eadesigndev\ComposerRepo\Helper\Data;
use Eadesigndev\ComposerRepo\Model\Customer\CustomerPackagesRepository;
use Eadesigndev\ComposerRepo\Model\PackagesRepository;
use Magento\Framework\View\Element\Template;
Expand All @@ -14,6 +15,8 @@
*/
class Packages extends Template
{
const PACKAGE = 'package';

/**
* @var Session
*/
Expand All @@ -31,6 +34,8 @@ class Packages extends Template
*/
private $searchCriteria;

private $dataHelper;

/**
* Auth constructor.
* @param Template\Context $context
Expand All @@ -44,44 +49,49 @@ public function __construct(
SearchCriteriaBuilder $searchCriteria,
PackagesRepository $packagesRepository,
CustomerPackagesRepository $customerPackagesRepository,
Data $dataHelper,
array $data = []
)
{
$this->session = $session;
$this->searchCriteria = $searchCriteria;
$this->packagesRepository = $packagesRepository;
) {
$this->session = $session;
$this->searchCriteria = $searchCriteria;
$this->packagesRepository = $packagesRepository;
$this->customerPackagesRepository = $customerPackagesRepository;
$this->dataHelper = $dataHelper;

parent::__construct($context, $data);
}

public function customerPackages()
{
$session = $this->session;
$isLoggedIn = $session->isLoggedIn();
$customerId = $session->getCustomerId();

$searchCriteriaBuilder = $this->searchCriteria;
$searchCriteria = $searchCriteriaBuilder->addFilter(
'customer_id',
10
$customerId
)->create();
$customerKey = $this->customerPackagesRepository->getList($searchCriteria);
$items = $customerKey->getItems();

return $items;
$completeItems = [];
foreach ($items as $item) {
$completeItems[] = $this->packages($item);
}

return $completeItems;
}

public function packages()
public function packages($item)
{
$searchCriteriaBuilder = $this->searchCriteria;
$searchCriteria = $searchCriteriaBuilder->addFilter(
'entity_id',
6
)->create();
$packages = $this->packagesRepository->getList($searchCriteria);
$items = $packages->getItems();
$package = $this->packagesRepository->getById($item->getId());
$item->setData(self::PACKAGE, $package);

return $items;
return $item;
}

public function repoUrl()
{
return $this->dataHelper->getConfigUrl();
}
}
}
21 changes: 14 additions & 7 deletions Console/ComposerRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Eadesigndev\ComposerRepo\Console;

use Magento\Framework\App\Action\Context;
use Eadesigndev\ComposerRepo\Model\Command\Exec;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -14,18 +14,25 @@
class ComposerRepo extends Command
{

public function __construct($name = null)
{
public $exec;

public function __construct(
Exec $exec,
$name = null
) {
$this->exec = $exec;
parent::__construct($name);
}

protected function configure()
public function configure()
{
$this->setName('eadesign:composerrepo')->setDescription('Prints hello world.');
$this->setName('eadesign:composerrepo')->setDescription('Create packages.');
}

protected function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Hello World!');
$this->exec->run();

$output->writeln('The composer repositories are built!');
}
}
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function execute()
$resultPage->addBreadcrumb(__('Packages'), __('Packages'));
$resultPage->getConfig()->getTitle()->prepend(__('Composer Packages'));

$this->exec->run();
// $this->exec->run();

$dataPersistor = $this->_objectManager->get(\Magento\Framework\App\Request\DataPersistorInterface::class);
$dataPersistor->clear('cms_page');
Expand Down
33 changes: 22 additions & 11 deletions Controller/Index/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,46 @@

namespace Eadesigndev\ComposerRepo\Controller\Index;

use Magento\Framework\App\Action\Action;
use Magento\Customer\Controller\AbstractAccount;
use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Customer\Model\Session;

/**
* Class Auth
* @package Eadesigndev\ComposerRepo\Controller\Auth
*/
class Auth extends Action
class Auth extends AbstractAccount
{
/**
* @var PageFactory
*/
protected $resultPageFactory;
private $resultPageFactory;

/**
* Auth constructor.
* @var Session
*/
private $session;

/**
* Packages constructor.
* @param Context $context
*/

/**
* Packages constructor.
* @param Context $context
* @param PageFactory $resultPageFactory
* @param Session $session
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory
PageFactory $resultPageFactory,
Session $session
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
$this->session = $session;
}

/**
Expand All @@ -41,12 +51,13 @@ public function __construct(
*/
public function execute()
{
$this->_view->loadLayout();
if ($block = $this->_view->getLayout()->getBlock('composerrepo_auth')) {
$block->setRefererUrl($this->_redirect->getRefererUrl());
if ($this->session->authenticate()) {
$this->_view->loadLayout();
if ($block = $this->_view->getLayout()->getBlock('composerrepo_auth')) {
$block->setRefererUrl($this->_redirect->getRefererUrl());
}
$this->_view->getPage()->getConfig()->getTitle()->set(__('Composer authentication keys'));
$this->_view->renderLayout();
}
$this->_view->getPage()->getConfig()->getTitle()->set(__('Composer authentication keys'));
$this->_view->renderLayout();
}
}

Loading

0 comments on commit 675cbf5

Please sign in to comment.