Skip to content

Instantly share code, notes, and snippets.

Avatar

Jesus Manuel Olivas jmolivas

View GitHub Profile
@jmolivas
jmolivas / EntityRepository.php
Created Mar 26, 2014
Entity repository extract
View EntityRepository.php
/**
* @param integer $id
*
* @return array
*/
public function findBySomething($id)
{
$queryBuilder = $this->queryBySomething($id);
return $queryBuilder->getQuery()->getResult();
@jmolivas
jmolivas / Vagrantfile
Created Apr 29, 2014
Adding customizable configuration to Vagrantfile
View Vagrantfile
require "yaml"
parameter_file = "./parameters.yml"
parameters = Array.new(0)
if File.exists?(parameter_file)
parameters = YAML::load_file(parameter_file)
end
# Apply configuration values if available
@jmolivas
jmolivas / gist:90b406b459b76a5e374e
Created Sep 1, 2014
ORM won't kill any kittens
View gist:90b406b459b76a5e374e
public function indexAction(){
$entityManager = $this->getDoctrine()->getManager();
$articles = $entityManager->getRepository('ORMDemoBundle:Article')->findAll();
return $this->render(
'ORMDemoBundle:Article:index.html.twig',
['articles' => $articles]
);
@jmolivas
jmolivas / console-container-debug.sh
Last active Aug 29, 2015
Two Drupal core bugs found using the console project
View console-container-debug.sh
$ bin/console container:debug
View ContainerAwareCommand.php
<?php
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Drupal\Core\Extension\ExtensionDiscovery;