codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php namespace Namespace\Custom\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; class Custom extends AbstractDb { /** * Resource initialization * * @return void */ protected function _construct() { $this->_init('namespace_custom', 'custom_id'); } public function addRelations($data) { $this->getConnection() ->insertMultiple('namespace_customtable', $data); } public function getAssociatedProductIds($customId) { $select = $this->getConnection()->select(); $select->from( ['cp' => 'namespace_customtable'], 'product_id' ) ->where('custom_id=?', $customId); return $this->getConnection()->fetchCol($select); } }
Private
[
?
]
Run code
Submit