Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-directory
Model
ResourceModel
Country.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Directory\Model\ResourceModel
;
7
14
class
Country
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
15
{
21
protected
function
_construct
()
22
{
23
$this->
_init
(
'directory_country'
,
'country_id'
);
24
}
25
34
public
function
loadByCode
(\
Magento
\Directory\Model\
Country
$country,
$code
)
35
{
36
switch
(strlen(
$code
)) {
37
case
2:
38
$field =
'iso2_code'
;
39
break
;
40
41
case
3:
42
$field =
'iso3_code'
;
43
break
;
44
45
default
:
46
throw
new \Magento\Framework\Exception\LocalizedException(
47
__
(
'Please correct the country code: %1.'
, htmlspecialchars(
$code
))
48
);
49
}
50
51
return
$this->
load
($country,
$code
, $field);
52
}
53
}
__
__()
Definition:
__.php:13
Magento\Framework\Model\ResourceModel\Db\AbstractDb\_init
_init($mainTable, $idFieldName)
Definition:
AbstractDb.php:186
Magento\Directory\Model\ResourceModel
Magento\Framework\Model\ResourceModel\Db\AbstractDb\load
load(\Magento\Framework\Model\AbstractModel $object, $value, $field=null)
Definition:
AbstractDb.php:339
Magento
Magento\Framework\Model\ResourceModel\Db\AbstractDb
Definition:
AbstractDb.php:24
Magento\Directory\Model\ResourceModel\Country
Definition:
Country.php:14
$code
$code
Definition:
info.phtml:12
Magento\Directory\Model\ResourceModel\Country\_construct
_construct()
Definition:
Country.php:21
Magento\Directory\Model\ResourceModel\Country\loadByCode
loadByCode(\Magento\Directory\Model\Country $country, $code)
Definition:
Country.php:34