Skip to content

Instantly share code, notes, and snippets.

@wms
wms / -
Created June 1, 2014 21:59
GAME
{
version = 0.23.5
Title = dev (SANDBOX)
Description = No description available.
linkURL =
linkCaption =
Mode = 0
Status = 1
scene = 5
@wms
wms / -
Created May 28, 2014 16:13
diff --git a/data/model/Relationship.php b/data/model/Relationship.php
index 0e9c184..77619a5 100644
--- a/data/model/Relationship.php
+++ b/data/model/Relationship.php
@@ -208,7 +208,7 @@ class Relationship extends \lithium\core\Object {
$conditions = (array) $this->constraints();
foreach ($this->key() as $from => $to) {
- if (!isset($object->{$from})) {
+ if ($object->{$from} === null) {
<?php
Groups::all([
'conditions' => [
'users' => '_id_'
// or...
'users' => ['_id']
]
]);
@wms
wms / gist:7749187
Last active December 30, 2015 00:19
public static function find($type, array $options = array())
{
// @todo: determine the Model to use instead of hard-coded 'User'
$options['conditions']['User.deleted'] = 0;
// @todo: add this condition for each 'With' relation instead of hard-coded 'Email'
$options['conditions']['Email.deleted'] = 0;
return parent::find($type, $options);
}
<?php
Users::all(array(
'with' => 'Email',
'conditions' => array(
'User.deleted' => 0,
'Email.deleted' => 0
)
));
<?php
use lithium\analysis\Logger;
use lithium\data\Connections;
Logger::config([
'default' => [
'adapter' => 'File',
'file' => function() { return "combined.log"; },
'format' => "{:timestamp} {:priority}\t{:message}\n"
@wms
wms / Form.php
Created August 6, 2012 10:32 — forked from toomuchpete/Form.php
Lithium Form Helper for Twitter Bootstrap
<?php
namespace app\extensions\helper;
class Form extends \lithium\template\helper\Form {
/**
* String templates used by this helper.
*
* @var array