Skip to content

Instantly share code, notes, and snippets.

@tdutrion
tdutrion / notes.md
Last active May 16, 2018 09:32
ZF3 and Doctrine get started - Florent Blaison

Setup the project

Official tutorial from which this is adapted:

Get the project skeleton

Clone the project from Florent's repository (updated ZF3 quickstart):]

git clone git@github.com:Orkin/tsi-getting-start.git
@vhenzl
vhenzl / _readme.md
Last active February 21, 2022 09:29
Awesome whatever (PHP, DDD, CQRS, events & messaging, Doctrine, REST & APIs, PHPStorm,... links)

Awesome whatever

Collection of various links – blogs, articles, libraries/frameworks & repos, etc. Not necessarily really awesome.

Content

@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

/**
* @return ViewModel
*/
public function registerAction()
{
$form = new RegisterForm();
if (($result = $this->prg()) instanceof Response) {
return $result;
} elseif ($result !== false) {
<?php
namespace Common\Registry;
class Registry
{
/**
* @var array
*/
protected static $container = array();
<?php
namespace User\Form;
use Common\Registry\Registry;
use DoctrineORMModule\Stdlib\Hydrator\DoctrineEntity as DoctrineHydrator;
use User\Entity\StudentSkill as StudentSkillEntity;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
@bakura10
bakura10 / gist:3792956
Created September 27, 2012 08:50
Form
<?php
namespace User\Form;
use Common\Registry\Registry;
use DoctrineORMModule\Stdlib\Hydrator\DoctrineEntity as DoctrineHydrator;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
class Student extends AbstractUser
{
<?php
// Par défaut, Doctrine t'offre ces différents events :
// PostLoad, PostPersist, PostRemove, PostUpdate
// PrePersist, PreRemove, PreUpdate
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks // <=== Active le mécanisme d'évènements
*/
@Ocramius
Ocramius / User.php
Last active February 16, 2024 14:57
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