Skip to content

Instantly share code, notes, and snippets.

View manuakasam's full-sized avatar

Manuel St. manuakasam

  • Germany, NRW, Duisburg
View GitHub Profile
@lacri42
lacri42 / safeRecursiveArrayAccess.php
Created August 18, 2016 16:25
This method checks if an array key exists recursively and returns its value on existence. Optionally validates the value against a callable.
<?php
/**
* This method checks if an array key exists recursively and returns its value on existence.
* Optionally validates the value against a callable.
*
* Example without callable:
* <code>
* $myArray = [
* "foo" => [
* "bar" => [
@gnutix
gnutix / DoctrineDbalStatementInterface.php
Created December 2, 2013 09:07
Mock Builder for Doctrine EntityManager / Connection mock objects.
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
@manuakasam
manuakasam / gist:6317890
Created August 23, 2013 10:36
Enable Translations
use Zend\Validator\AbstractValidator;
public function onBootstrap($e)
{
$translator = $e->getApplication()->getServiceManager()->get('translator');
AbstractValidator::setDefaultTranslator($translator);
}
@Ocramius
Ocramius / User.php
Last active July 24, 2024 14:38
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User