Skip to content

Instantly share code, notes, and snippets.

@rapzo
rapzo / composer
Created August 19, 2013 16:18
Composer example to use with lithium php framework (lithify.me)
{
"repositories": [{
"type": "package",
"package": {
"name": "unionofrad/lithium/lithium",
"version": "dev-master",
"type": "lithium-library",
"source": {
"url": "https://github.com/UnionOfRAD/lithium",
"type": "git",
var FormView = Backbone.View.extend({
el: '#form',
events: {
// Fired automatically when a file-type input is detected with a
// non-blank value. You can use this hook to implement a handler that
// will deal with those non-blank file inputs. Returning false will
// disallow standard form submission.
'ajax:aborted:file' : 'ajaxAbortedFile',
class BaseModel extends \lithium\data\Model {
public function save($entity, $data = null, array $options = []) {
$now = new \MongoDate();
if (!$entity->exists()) {
$entity->created = $now;
}
$entity->updated = $now;
return parent::save($entity, $data, $options);
}
@rapzo
rapzo / Base.php
Last active December 17, 2015 08:59 — forked from nateabele/Base.php
<?php
namespace my_app\models;
use MongoId;
use lithium\data\collection\DocumentSet;
use lithium\data\entity\Document;
use lithium\util\Inflector;
use lithium\core\Libraries;
use lithium\util\Set;
<?php
namespace app\tests\cases\controllers;
use app\tests\mocks\MockArticlesController;
use app\tests\mocks\action\MockControllerRequest as Request; //Mocking the Request
class ArticlesControllerTest extends \lithium\test\Unit {
protected $_controller;
@rapzo
rapzo / media.php
Created March 19, 2012 19:13 — forked from nateabele/media.php
An example of how to completely reconfigure Lithium's templating engine
<?php
use lithium\net\http\Media;
/**
* This re-maps your template paths so you can have stuff like `pages/users_{username}.php`
* instead of the Lithium default.
*/
Media::type('html', 'text/html', array(
'view' => 'lithium\template\View',