Skip to content

Instantly share code, notes, and snippets.

@norbe
norbe / WhereMultiInBuilder.php
Created January 10, 2017 15:44
How to create IN condition on more columns in nette database
/**
* Create where query parts needed for filtering rows by more than 1 value per row.
*
* Example:
* For [[value: 1, type: 2],[value: 2, type: 3]]
* creates (value = 1 AND type = 2) OR (value = 2 AND type = 3)
*
* @author Karel Hák <[email protected]>
*/
class WhereMultiInBuilder extends \Nette\Object {
@norbe
norbe / TransactionManager.php
Last active August 29, 2015 14:15
PDO Transaction manager
<?php
/********************************************************************\
/* This file is part of the FREGIS System (http://www.fregis.cz) \
/* Copyright (c) 2012 Karel Hák, Martin Jelič, Jakub Kocourek \
/* /
/* @license Use it as you want /
/********************************************************************/
namespace Fregis\Database;
@norbe
norbe / gist:e36f994914da5e2bb43e
Created July 25, 2014 07:38
spawn-php windows
# -*- coding: utf-8 -*-
#
# spawn-php.py
# This is a program to spawn php-cgi on windows.
#
# Author: [email protected]
#
# Version 1.0
#
@norbe
norbe / config.yaml
Created March 10, 2014 11:56
PuPHPet: No title provided and :package is not a valid resource reference
---
vagrantfile-local:
vm:
box: ubuntu-precise1204-x32-vbox43
box_url: 'http://files.vagrantup.com/precise32.box'
hostname: vm.fregis.cz
network:
private_network: 192.168.56.101
forwarded_port: { }
provider:
@norbe
norbe / Description
Created August 22, 2011 10:30
NotORM test
NotORM test based on OSI DAYS example (http://www.notorm.com/static/osidays2010.zip).
For testing purpose I was add author_id column to TAG table and then try to load applications filtered by application.author.name and application.tag.author.name in the same time.
Problem is that NotORM doesn't use aliases, so I can't work with one table more than once (from another context).
Do you know how to solve it? Please update my index.php file..