dflydev / dflydev-doctrine-orm-service-provider

Doctrine ORM Service Provider
MIT License
209 stars 59 forks source link

orm.em.options / mappings (type = annotations) / namespace cannot be empty #8

Open quazardous opened 11 years ago

quazardous commented 11 years ago

In the ORM doc : http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html You can have entity class without namespace.

but an error occurs if you let namespace option empty for annotations mapping.

simensen commented 11 years ago

@quazardous Can you point to specific part of those docs that describe what you are saying? I'd be happy to look into this but most of the stuff I've looked at RE: annotations have still required a namespace.

Also, if you can share your specific use case that would be helpful.

I apologize for the delay on this.

quazardous commented 11 years ago

First example in ORM doctrine doc:

// src/Product.php
/**
 * @Entity @Table(name="products")
 **/
class Product
{
  /** @Id @Column(type="integer") @GeneratedValue **/
  protected $id;
  /** @Column(type="string") **/
  protected $name;

  // .. (other code)
}

There is no namespace.

I tried something like that to learn:

"mappings" => array(
        // Using actual filesystem paths
        array(
            "type" => "annotation",
            "namespace" => "",
            "path" => __DIR__."/src",
        ),
....

But i got an error.

This is not very important in real case ;p

simensen commented 11 years ago

OK. :) Mind if I close this issue then?

quazardous commented 11 years ago

man it's your code ;p do as you pleaz ;p

marcojanssen commented 10 years ago

Who doesn't use namespaces? :P

dominikzogg commented 10 years ago

try "namespace" => "\"

dominikzogg commented 10 years ago

@marcojanssen +1

simensen commented 10 years ago

I believe the feedback I got from one of the Doctrine team people (can't remember who answered me anymore) was that it had to do with the chain driver requiring a namespace.

@dominikzogg Have you tested it with "namespace" => "\\"? If that actually works that can be the official suggestion and we can close this.

dominikzogg commented 10 years ago

@simensen nah, it was only a suggestion