Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class PluginMaterial_ModuleMaterial_MapperMaterial extends Mapper {
- public function AddWithOutCommit($oMaterial) {
- $sql = "INSERT INTO " . Config::Get('db.table.material') . "
- (material_type, material_link, material_name, material_description, material_params, material_commit)
- VALUES (?, ?, ?, ?, ?);";
- $iId = $this->oDb->query($sql, $oMaterial->getType(), $oMaterial->getLink(), $oMaterial->getName(), $oMaterial->getDescription(), $oMaterial->getParams(), false);
- if ($iId) {
- return $iId;
- }
- return false;
- }
- public function GetAll() {
- $sql = 'SELECT * FROM ' . Config::Get('db.table.material') . ' WHERE ' . Config::Get('db.table.material') . '.material_commit = TRUE';
- $aResult = array();
- if ($aRows = $this->oDb->query($sql)) {
- foreach ($aRows as $aRow) {
- $aResult[] = Engine::GetEntity('PluginMaterial_ModuleMaterial_Entity' . $aRow['material_type'] . 'Material', $aRow);
- }
- }
- return $aResult;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment