Created
February 12, 2019 04:09
-
-
Save webnitros/bc2cf0417df58a945202a55683519d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyControllerPayment extends modRestController { | |
public $classKey = 'msPayment'; | |
public $defaultSortField = 'rank'; | |
public $defaultLimit = 20; | |
public $headers = array( | |
'Access-Control-Allow-Methods' => 'GET', | |
); | |
public $fields = 'id,name,description,price,logo,active'; | |
/* @inheritdoc */ | |
public function initialize() | |
{ | |
$miniShop2 = $this->modx->getService('miniShop2'); | |
$miniShop2->initialize('web'); | |
} | |
/* @inheritdoc */ | |
protected function prepareListObject(xPDOObject $object) | |
{ | |
$data = $object->toArray(); | |
$data['value'] = $data['id']; | |
$data['text'] = $data['name']; | |
return $data; | |
} | |
/* @inheritdoc */ | |
public function prepareListQueryAfterCount(xPDOQuery $c) | |
{ | |
$c->where(array( | |
'active' => true | |
)); | |
return $c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment