Skip to content

Instantly share code, notes, and snippets.

@core01
Last active March 10, 2016 15:17
Show Gist options
  • Save core01/031bd83906225339597a to your computer and use it in GitHub Desktop.
Save core01/031bd83906225339597a to your computer and use it in GitHub Desktop.
Пример кода с pdoFetch
<?
public function getSelfCost($ingredientId, $stockId)
{
$pdo = $this->modx->getService('pdoFetch');
$pdo->setConfig(array(
'class' => 'msInventoryIngredientInfo',
'innerJoin' => array(
'msInventoryIngredient' => array(
'class' => 'msInventoryIngredient',
'on' => 'msInventoryIngredient.invent_id = msInventoryIngredientInfo.invent_id'
)
),
'select' => array(
'msInventoryIngredientInfo' => 'ingredient_id,count',
'msInventoryIngredient' => 'cost'),
'where' => array(
'expired' => 0,
'ingredient_id' => $ingredientId,
'stock_id' => $stockId,
),
'sortby' => 'msInventoryIngredientInfo.invent_id',
'sortdir' => 'ASC',
));
$ingredients = $pdo->run();
$output = array();
foreach($ingredients as $ingredient){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment