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-send-friend
Model
ResourceModel
SendFriend.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\SendFriend\Model\ResourceModel
;
7
16
class
SendFriend
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
17
{
23
protected
function
_construct
()
24
{
25
$this->
_init
(
'sendfriend_log'
,
'log_id'
);
26
}
27
38
public
function
getSendCount
($object, $ip, $startTime,
$websiteId
=
null
)
39
{
40
$connection
= $this->
getConnection
();
41
$select
=
$connection
->select()->from(
42
$this->
getMainTable
(),
43
[
'count'
=>
new
\
Zend_Db_Expr
(
'count(*)'
)]
44
)->where(
45
'ip=:ip
46
AND time>=:time
47
AND website_id=:website_id'
48
);
49
$bind = [
'ip'
=> $ip,
'time'
=> $startTime,
'website_id'
=> (int)
$websiteId
];
50
51
$row
=
$connection
->fetchRow(
$select
, $bind);
52
return
$row
[
'count'
];
53
}
54
63
public
function
addSendItem
($ip, $startTime,
$websiteId
)
64
{
65
$this->
getConnection
()->insert(
66
$this->
getMainTable
(),
67
[
'ip'
=> $ip,
'time'
=> $startTime,
'website_id'
=>
$websiteId
]
68
);
69
return
$this;
70
}
71
78
public
function
deleteLogsBefore
($time)
79
{
80
$cond = $this->
getConnection
()->quoteInto(
'time<?'
, $time);
81
$this->
getConnection
()->delete($this->
getMainTable
(), $cond);
82
83
return
$this;
84
}
85
}
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getMainTable
getMainTable()
Definition:
AbstractDb.php:264
Magento\Framework\Model\ResourceModel\Db\AbstractDb\_init
_init($mainTable, $idFieldName)
Definition:
AbstractDb.php:186
Zend_Db_Expr
Definition:
Expr.php:49
Magento\SendFriend\Model\ResourceModel\SendFriend\_construct
_construct()
Definition:
SendFriend.php:23
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
Magento\SendFriend\Model\ResourceModel
Magento\SendFriend\Model\ResourceModel\SendFriend\deleteLogsBefore
deleteLogsBefore($time)
Definition:
SendFriend.php:78
Magento\Framework\Model\ResourceModel\Db\AbstractDb
Definition:
AbstractDb.php:24
$connection
$connection
Definition:
bulk.php:13
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getConnection
getConnection()
Definition:
AbstractDb.php:325
$websiteId
$websiteId
Definition:
products_with_websites_and_stores.php:11
Magento\SendFriend\Model\ResourceModel\SendFriend\getSendCount
getSendCount($object, $ip, $startTime, $websiteId=null)
Definition:
SendFriend.php:38
Magento\SendFriend\Model\ResourceModel\SendFriend\addSendItem
addSendItem($ip, $startTime, $websiteId)
Definition:
SendFriend.php:63
$row
$row
Definition:
cart_rule_free_shipping.php:12
Magento\SendFriend\Model\ResourceModel\SendFriend
Definition:
SendFriend.php:16