Skip to content

Instantly share code, notes, and snippets.

public function executeIndex(sfWebRequest $request)
{
$this->mouses = Doctrine::getTable('Mouse')
->createQuery('m')
->leftJoin('m.LabStrain s')
->leftJoin('m.MouseCage j')
->leftJoin('j.Cage c')
->where('j.dateout = ?', "0000-00-00")
->execute();
@Tocacar
Tocacar / gist:2037474
Created March 14, 2012 16:00
YUI2in3 Calendar Plugin
/*
* @class AMS.Calendar
* @extends Widget
* @version 1.0.0
*
*/
YUI.add("ams-calendar", function(Y) {
Y.log('ams-calendar is loaded', 'info');
@Tocacar
Tocacar / gist:2037690
Created March 14, 2012 16:33
Implementing Calendar Plugin
detailsBtn = new Y.Button({
srcNode: Y.one('#button_edit_details')
});
detailsBtn.getNode().on('click', function(e){
e.preventDefault();
//retrieve & display relevant form partial from server
var requestData = new Y.AMS.PanelComment({
@Tocacar
Tocacar / gist:2412688
Created April 18, 2012 10:28
SQL query
SELECT
p.id
FROM
project_licence p
INNER JOIN
lab l
ON
p.lab_id = l.id
RIGHT OUTER JOIN
lab_user lu
@Tocacar
Tocacar / gist:2428052
Created April 20, 2012 11:59
DoctrineChoice query
$relatedStrainQuery = Doctrine_Query::create()
->select('id')
->from('Strain s')
->where('s.lab_id = ?', $this->getOption('pref_lab_id'));
$this->widgetSchema['strain_id'] = new sfWidgetFormDoctrineChoice(array(
'model' => $this->getRelatedModelName('Strain'),
'query' => $relatedStrainQuery,
@Tocacar
Tocacar / gist:2428131
Created April 20, 2012 12:11
Another query
//this is giving me an array of project_licence id numbers
public function getAssignedProjectLicenceIds() {
$user_id = $this->getId();
$connection = Doctrine_Manager::connection();
$query = 'SELECT
p.id as ids
@Tocacar
Tocacar / gist:2476961
Created April 24, 2012 06:04
sf2 entity form field
$builder->add('category_id', 'entity', array('class' => 'MySampleBundle:Category',
'empty_value' => 'Choose a category'
));
class Fur extends BaseFur
{
public function __toString()
{
return $this->getColour();
}
@Tocacar
Tocacar / gist:2635086
Created May 8, 2012 13:38
Infinite scrolling datatable plugin YUI 3.5.1
YUI.add('dt-scroll', function(Y){
Y.DtScroll = Y.Base.create('dt-scroll', Y.Plugin.Base, [], {
_scroll : true,
_scrollbarNode: null,
_loaderNode : null,
_noticeNode : null,
_datasource: null,
_page : 2,
/*
* Is it OK to pass an array of params to the getCages table method?
* Or should I specify each param individually?
* Just worried that would be a very long method signature (if that's the right phrase)
*/
// the controller action, which calls a getCages() table method
public function executeSearch(sfWebRequest $request) {