Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"use" php statement multiple?

Tags:

php

symfony

silex

Is there any way to make a "multiple use"?

I'm using an plugin in Silex to use ORM with it, and in each Entity I have to make a use like this:

use Doctrine\ORM\Mapping\Entity,
    Doctrine\ORM\Mapping\Table,
    Doctrine\ORM\Mapping\Id,
    Doctrine\ORM\Mapping\Column,
    Doctrine\ORM\Mapping\GeneratedValue,
    Doctrine\ORM\Mapping\ManyToOne,
    Doctrine\ORM\Mapping\ManyToOne;

So, my question is, is there in PHP a "multiple using" like Java? I mean:

use Doctrine\ORM\Mapping\*;

Or maybe using an autoload technique made by Silex/Symfony or something?

like image 955
mowcixo Avatar asked Feb 26 '13 13:02

mowcixo


1 Answers

Why not do this...

use Doctrine\ORM\Mapping as ORM;

Then in your annotations...

/**
 * @ORM\Column(type="int")
 */
 protected $name;

And so on...

like image 85
JamesHalsall Avatar answered Sep 28 '22 14:09

JamesHalsall