Para todos los mozos activos, me trae sus mesas abiertas
@param int $mozo_id id del mozo, en caso de que no le pase ninguno, me busca todos
@return array Mozos con sus mesas, Comandas, detalleComanda, productos y sabores
359315
public function mesasAbiertas($mozo_id = null, $lastAccess = null){
            $conditions = array();
            
            // si vino el mozo por parametro, es porque solo quiero las mesas de ese mozo
            if ( !empty($mozo_id) ){
               $conditions['Mozo.id'] =  $mozo_id;
            } else {
                // todos los mozos activos
                $conditions['Mozo.activo'] =  1;
            }
            
            // condiciones para traer mesas abiertas y pendientes de cobro
            if ( Configure::read('Site.type') == SITE_TYPE_HOTEL ) {
                // si es hotel
                $conditionsMesa = array(
                    'Mesa.deleted' => 0,        
                    'Mesa.checkin >' => date('Y-m-d', strtotime('-1 month')),
                );
            } else {
                // es restaurante u otros comercios
                $conditionsMesa = array(
                    "Mesa.estado_id" => array( MESA_ABIERTA, MESA_CERRADA, MESA_COBRADA),
                    'Mesa.deleted' => 0,    
                );
            }
            
            // si vino el parametro lastAccess, traer solo las mesas actualizadas luego del ultimo pedido
            if ( !empty($lastAccess) ) {
                $conditionsMesa['Mesa.modified >='] = $lastAccess;
            }
            
            $contain = $this->Mesa->defaultContain;
            $contain['conditions'] = $conditionsMesa;
            unset($contain[0]);
            $optionsCreated = array(
                'contain' => array('Mesa' => $contain),
                'conditions'=> $conditions,
            );
			$mesasABM = $this->find('all', $optionsCreated);

            $mozosMesa = array();
            foreach ( $mesasABM as $abmMesas ) {
                // traer todos los mozos, con su array de mesas
                $abmMesas['Mozo']['mesas'] = $abmMesas['Mesa'];

                if ( !empty($lastAccess) ) {
                    // enviar solo los que tienen mesas modificadas
                    if (!empty($abmMesas['Mesa']) ) {
                        $mozosMesa['mozos'][] = $abmMesas['Mozo'];    
                    }
                } else {
                    // enviar a todos
                    $mozosMesa['mozos'][] = $abmMesas['Mozo'];    
                }
            }
            

            return $mozosMesa;
        }
1001451
public function getTranslatedList($user_id, $status = true)
    {
        $conditions = array(
            'status' => $status,
            'user_id' => $user_id
        );

        $addresses = array();
        foreach ((array) $this->getList($conditions) as $address_id => $address) {
            $addresses[$address_id] = $this->getTranslated($address, true);
        }

        return $addresses;
    }
105105
public function where($id)
    {
        $this->validateIdentifier($id);

        if (!is_array($id)) {
            $key = reset($this->keys);
            return [$key => $id];
        } else {
            return $id;
        }
    }
813155
public static function find($id) { 
        $array = KernelDB::find(static::$model, $id);
        $routeModel = Dir::apiModel(static::$model);
        return self::arrayToModel($routeModel, $array);
    }
673887
public function getOverriddenMethodIds($method_id)
    {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        $class_storage = $this->classlike_storage_provider->get($fq_class_name);

        if (isset($class_storage->overridden_method_ids[$method_name])) {
            return $class_storage->overridden_method_ids[$method_name];
        }

        return [];
    }
170090
public function get($module_id)
    {
        $modules = $this->getList();
        return empty($modules[$module_id]) ? array() : $modules[$module_id];
    }
302845
protected function getIDListFromDB() : array
    {
        $arElementIDList = (array) Product::getByCategory($this->sValue)
            ->where('brand_id', '>', 0)
            ->lists('brand_id', 'id');

        $obCategory = Category::find($this->sValue);
        if (!empty($obCategory)) {
            $arAdditionalElementIDList = (array) $obCategory->product_link()
                ->where('brand_id', '>', 0)
                ->lists('brand_id', 'id');

            $arElementIDList = $arElementIDList + $arAdditionalElementIDList;
        }

        return $arElementIDList;
    }
752542
public function exportById($id): array
    {
        $section = Craft::$app->sections->getSectionById((int) $id);

        return $this->export($section);
    }
643505
public function exportById($id): array
    {
        $volume = Craft::$app->volumes->getVolumeById((int) $id);

        return $this->export($volume);
    }
303354
public function get($id): ?array
  {
    if ( $this->check() ){
      $d = $this->db->rselect('bbn_observers', [], [
        'id' => $id
      ]);
      if ( !$d['id_alias'] ){
        return $d;
      }
      $alias = $this->db->rselect('bbn_observers', [], [
        'id' => $d['id_alias']
      ]);
      $alias['id'] = $d['id'];
      $alias['result'] = $d['result'];
      $alias['id_alias'] = $d['id_alias'];
      return $alias;
    }
    return null;
  }
871791
public function get_properties($account_id) {
		$result = array();
		try {
			if ( $this->ga ) {
				$properties = $this->ga
					->management_webproperties
					->listManagementWebproperties( $account_id );
				$result     = $properties->getItems();
			}
		} catch ( \Exception $e ) {
			// Do nothing.
			error_log($e->getMessage(), $e->getCode());
		}
		return $result;
	}
1067658
public function getReleaseAssets(string $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/:id/assets',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $id));
    }
1112373
function array_listado($categoria_id = 1){  
    $array_categoria = array(); 
                $array_final = array();
                
    $this->recursive = 1;
    $this->id = $categoria_id;
    //                $this->contain(array(
    //                    'Producto', 
    //                    'Sabor',
    //                ));
    $array_categoria = $this->read();
    if (empty($array_categoria)) {
        return array();
    }
    $array_final = $array_categoria['Categoria'];
    $array_final['Producto'] = $array_categoria['Producto'];
    $array_final['Sabor'] = $array_categoria['Sabor'];
    //agarro los herederos del ROOT
    $resultado = $this->children($categoria_id,1);

    foreach ($resultado as $r):
                    $hijos = $this->array_listado($r['Categoria']['id']);
                    if (count($hijos) > 0) {
      $array_final['Hijos'][] = $hijos;
                    }
    endforeach;

                if ($array_final == false) {
                    $array_final = array();
                }
    return $array_final;
  }
1370685
public function get($id = null) {
		if (empty($id)) {
			return false;
		}

		$fields = [
			$this->alias . '.id',
			$this->alias . '.value',
		];
		$blockExists = $this->hasField('block');
		if ($blockExists) {
			$fields[] = $this->alias . '.block';
		}
		$conditions = [$this->alias . '.id' => $id];
		$this->recursive = -1;

		return $this->find('first', compact('fields', 'conditions'));
	}
612473
public function actionDelete($id)
    {
        $model = $this->findModel($id);

        $model->orderBy = $model::$defaultOrderBy;
        $model->page = $model->calcPage($model::find()->where(['parent_id' => $model->parent_id]));
        $returnTo = ['index', // try to return to same place - deletion may be unsuccessfull
            'parent_id' => $model->parent_id,
            'page'      => $model->page,
            'id'        => $id,
            'sort'      => $model->orderByToSort(),
        ];

        $model->delete();

        return $this->redirect($returnTo);
    }
971017
public function actionViewAjax($id)
    {
        $model = Article::findOne($id);
        if( $model === null ) throw new NotFoundHttpException("None exists article id");
        return [
            'likeCount' => (int)$model->getArticleLikeCount(),
            'scanCount' => $model->scan_count * 100,
            'commentCount' => $model->comment_count,
        ];
    }
358742
public function get($method_id)
    {
        $methods = $this->getList();
        return empty($methods[$method_id]) ? array() : $methods[$method_id];
    }