Skip to content

Commit a40cdc7

Browse files
committed
MAGETWO-66562: Add @api Annotation in Directory Module
- returned factories
1 parent 8203eb3 commit a40cdc7

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

app/code/Magento/Customer/Test/Unit/Controller/Address/FormPostTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Customer\Api\Data\RegionInterface;
1212
use Magento\Customer\Api\Data\RegionInterfaceFactory;
1313
use Magento\Customer\Controller\Address\FormPost;
14-
use Magento\Customer\Model\CustomerRegistry;
1514
use Magento\Customer\Model\Metadata\Form;
1615
use Magento\Customer\Model\Metadata\FormFactory;
1716
use Magento\Customer\Model\Session;
@@ -20,7 +19,6 @@
2019
use Magento\Directory\Model\RegionFactory;
2120
use Magento\Framework\Api\DataObjectHelper;
2221
use Magento\Framework\App\Action\Context;
23-
use Magento\Framework\App\ObjectManager;
2422
use Magento\Framework\App\RequestInterface;
2523
use Magento\Framework\App\Response\RedirectInterface;
2624
use Magento\Framework\Controller\Result\ForwardFactory;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Country factory
9+
*/
10+
namespace Magento\Directory\Model;
11+
12+
class CountryFactory
13+
{
14+
/**
15+
* @var \Magento\Framework\ObjectManagerInterface
16+
*/
17+
protected $_objectManager;
18+
19+
/**
20+
* @param \Magento\Framework\ObjectManagerInterface $objectManager
21+
*/
22+
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
23+
{
24+
$this->_objectManager = $objectManager;
25+
}
26+
27+
/**
28+
* Create new country model
29+
*
30+
* @param array $arguments
31+
* @return \Magento\Directory\Model\Country
32+
*/
33+
public function create(array $arguments = [])
34+
{
35+
return $this->_objectManager->create(\Magento\Directory\Model\Country::class, $arguments, false);
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Region factory
9+
*/
10+
namespace Magento\Directory\Model;
11+
12+
class RegionFactory
13+
{
14+
/**
15+
* @var \Magento\Framework\ObjectManagerInterface
16+
*/
17+
protected $_objectManager;
18+
19+
/**
20+
* @param \Magento\Framework\ObjectManagerInterface $objectManager
21+
*/
22+
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
23+
{
24+
$this->_objectManager = $objectManager;
25+
}
26+
27+
/**
28+
* Create new region model
29+
*
30+
* @param array $arguments
31+
* @return \Magento\Directory\Model\Region
32+
*/
33+
public function create(array $arguments = [])
34+
{
35+
return $this->_objectManager->create(\Magento\Directory\Model\Region::class, $arguments);
36+
}
37+
}

0 commit comments

Comments
 (0)