Skip to content

Instantly share code, notes, and snippets.

whereNested ( function ( $query )
{
$query -> where ( 'year' , '>' , 2000 );
$query -> where ( 'year' , '<' , 2005 );
})
<?php namespace Parfetts\Services;
class FileWriter
{
private
$_fileObject;
/**
* @param $filename
* @return void
$return = $this->_client->search(
array(
'index' => self::INDEX,
'type' => self::TYPE,
'body' => array(
'query' => array(
'bool' => array(
'must' => array(
'multi_match' => array(
'query' => $query,
/**
* Add an item submitted via the app upload
*
* @param $packId
* @param $quantity
* @param $price
* @param $trolleyId
*/
public function addFromApp($packId, $quantity, $price, $trolleyId)
{
$pdo = new \PDO('mysql:dbname=parfetts;host=localhost', '', '');
$pdo->beginTransaction();
$statement = $pdo->prepare("INSERT INTO trolley_items ( `trolley_id`,`pack_id`,`price`,`quantity` )
VALUES
( ?, ?, ?, ? )
ON DUPLICATE KEY UPDATE `quantity` = `quantity` + 1");
$statement->execute(array($trolleyId, $packId, $price, $quantity));
$pdo->commit();
/**
* Add an item submitted via the app upload
*
* @param array $items An array of items for adding to the Trolley
*/
public function addFromApp($items)
{
$pdo = DB::getPdo();
$pdo->beginTransaction();
$statement = $pdo->prepare("INSERT INTO trolley_items ( `trolley_id`,`pack_id`,`price`,`quantity` )
/**
* Add an item submitted via the app upload
*
* @param array $items An array of items for adding to the Trolley
* @return void
*/
public function addFromApp($items)
{
$pdo = DB::getPdo();
$pdo->beginTransaction();
/**
* Add an item submitted via the app upload
*
* @param array $items An array of items for adding to the Trolley
* @return void
*/
public function addFromApp($items)
{
$pdo = DB::getPdo();
$pdo->beginTransaction();
/**
* Add multiple items (used for opticon app upload)
*
* @param array $data
* @return array $feedback
*/
public function addMultipleItems($data)
{
$branchId = $this->_customer->getBranchId();
$trolleyId = $this->_trolleyRepository->findIdByCustomerId($this->_customer->getId());
--skip-syslog
--log-error=/var/log/mysqld.log
--pid-file=/var/run/mysqld/mysqld.pid