Last active
March 10, 2016 15:17
-
-
Save core01/031bd83906225339597a to your computer and use it in GitHub Desktop.
Пример кода с pdoFetch
This file contains hidden or 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
<? | |
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