Skip to content

Instantly share code, notes, and snippets.

View armetiz's full-sized avatar

Thomas Tourlourat armetiz

View GitHub Profile
@armetiz
armetiz / git_config
Created November 21, 2014 09:57
Update from EB CLI 2.6.3 to 2.6.4
[alias "aws.elasticbeanstalk"]
remote = !.git/AWSDevTools/aws.elasticbeanstalk.push --remote-url
push = !.git/AWSDevTools/aws.elasticbeanstalk.push
config = !.git/AWSDevTools/aws.elasticbeanstalk.config
createapplicationversion = !.git/AWSDevTools/aws.elasticbeanstalk.createapplicationversion
[aws "endpoint"]
us-east-1 = git.elasticbeanstalk.us-east-1.amazonaws.com
ap-northeast-1 = git.elasticbeanstalk.ap-northeast-1.amazonaws.com
eu-west-1 = git.elasticbeanstalk.eu-west-1.amazonaws.com
us-west-1 = git.elasticbeanstalk.us-west-1.amazonaws.com
@armetiz
armetiz / gist:1391489
Created November 24, 2011 14:42
Symfony2.XmlEncoder
Encode : array ( array ( "property_name" => ""), array ( "property_name" => ""));
<response>
<item key="0"><property_name /></item>
<item key="1"><property_name /></item>
</response>
Encode : array ( array ("property_name" => array ( null, null, null ) ), array ("property_name" => array ( null, null, null ) ) );
<response>
<item key="0">
<property_name />
@armetiz
armetiz / gist:1852137
Created February 17, 2012 09:29
Warmup error using php-cli only
#php app/console cache:warmup
Warming up the cache
[ErrorException]
Warning: session_start(): open(/var/lib/php/session/sess_XXX, O_RDWR) failed: No such file or directory (2) in /datas/www/tld.domain/subdomains/foo/httpdocs/vendor/symfony/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php line 87
@armetiz
armetiz / gist:1852492
Created February 17, 2012 10:24
Classes cache warmup.
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@armetiz
armetiz / gist:1854125
Created February 17, 2012 15:54
Override of logs_dir
class AppKernel extends Kernel {
public function getLogDir () {
if (array_key_exists("logs_dir", $_SERVER)) {
return $_SERVER["logs_dir"];
}
return parent::getLogDir ();
}
}
@armetiz
armetiz / gist:1854268
Created February 17, 2012 16:35
Monolog Handler for MongoDB
<?php
/*
*
* Thomas Tourlourat <thomas@tourlourat.com>
*/
namespace Acme\TestBundle\Monolog;
use Monolog\Logger;
@armetiz
armetiz / gist:1924172
Created February 27, 2012 14:25
No ids given, cannot create where in query in this case.
$query = $queryBuilder->getQuery();
$paginateQuery = Paginate::getPaginateQuery(
$query, $this->getOptions()->getOffset(), $this->getOptions()->getLimit()
);
return $paginateQuery;
@armetiz
armetiz / gist:2007282
Created March 9, 2012 16:10
deps file.
[symfony]
git=http://github.com/symfony/symfony.git
version=v2.0.10
[twig]
git=http://github.com/fabpot/Twig.git
version=v1.6.0
[monolog]
git=http://github.com/Seldaek/monolog.git
@armetiz
armetiz / gist:2028036
Created March 13, 2012 10:29
PHP - Object to Array
public function normalize($object, $format = null)
{
$reflectionObject = new \ReflectionObject($object);
$reflectionProperties = $reflectionObject->getProperties(\ReflectionMethod::IS_PUBLIC);
$attributes = array();
foreach ($reflectionProperties as $property) {
$attributeName = $property->getName();
$attributeValue = $property->getValue ($object);
$test = array();
$test["foo"] = "bar";
$tests = array();
$tests[] = $test;
echo "<pre>";
var_dump($test === $tests[0]); //true
var_dump($tests);