[DCOM-9] Annotation mapper tries to parse PHPDocblock annotations Created: 16/Jun/10  Updated: 16/Jun/10  Resolved: 16/Jun/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: 2.0.0-BETA2
Fix Version/s: 2.0.0-BETA3

Type: Bug Priority: Blocker
Reporter: Antoine Hedgecock Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None
Environment:

OS: Ubuntu, PHP version: 5.3.2



 Description   

In the upgrade from DC2 beta1 to beta2 the annonation mapper now starts to try and parse a some of the PHPDocblock annotations such as @package @subpackage but also the email adress in @author

Example of docblock

/**
 * @author Antoine Hedgecock <antoine@pmg.se>
 * @version 1.0.0
 */


/**
 * @package Models
 * @subpackage Default
 * 
 * @Entity(repositoryClass="Default_Model_Mapper_Category")
 * @Table(name="categories")
 * @InheritanceType("SINGLE_TABLE")
 * @DiscriminatorColumn(name="type", type="smallint")
 * @DiscriminatorMap({
 *  "0" = "Project_Model_Category"
 * })
 */

will cause it to try and load

Doctrine/ORM/Mapping/package.php
Doctrine/ORM/Mapping/subpackage.php
Doctrine/ORM/Mapping/pmg.php

note pmg because its in the email of the author annotation



 Comments   
Comment by Roman S. Borschel [ 16/Jun/10 ]

Please try with the latest version of Doctrine Common http://github.com/doctrine/common

See also DCOM-8

Comment by Antoine Hedgecock [ 16/Jun/10 ]

After comparing the source code version i found the following changes that could cause the issue

Line 249 in Beta2

$this->lexer->lookahead != null && ! $this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS) && ! ClassLoader::classExists($name)
Comment by Roman S. Borschel [ 16/Jun/10 ]

Fixed in the beta3 release that is already out now.





[DCOM-198] [GH-281] DCOM-194 Created: 10/Jun/13  Updated: 10/Jun/13  Resolved: 10/Jun/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/common/pull/281

Message:

Cleaned up version of #278



 Comments   
Comment by Marco Pivetta [ 10/Jun/13 ]

Duplicate of DCOM-194

Comment by Doctrine Bot [ 10/Jun/13 ]

A related Github Pull-Request [GH-281] was closed:
https://github.com/doctrine/common/pull/281





[DCOM-196] [GH-278] [DCOM-194] Fixed proxying magic getter with reference Created: 06/Jun/13  Updated: 10/Jun/13  Resolved: 10/Jun/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Majkl578:

Url: https://github.com/doctrine/common/pull/278

Message:

This is a proposal for a fix for DCOM-194(http://doctrine-project.org/jira/browse/DCOM-194) (and GH issue #276). This issue is important for us to be solved before 2.4.0 is out, since the base object class of Nette Framework, Nette\Object, uses this behavior, see https://github.com/nette/nette/blob/04e4e4b3ee36551fe99e63f91d9a839f7edc72ee/Nette/common/Object.php#L124-133.



 Comments   
Comment by Doctrine Bot [ 10/Jun/13 ]

A related Github Pull-Request [GH-278] was closed:
https://github.com/doctrine/common/pull/278

Comment by Marco Pivetta [ 10/Jun/13 ]

Duplicate of DCOM-194





[DCOM-176] [GH-256] Refactored AnnotationDriver to handle only required classes Created: 01/Mar/13  Updated: 01/Mar/13  Resolved: 01/Mar/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mattcockayne:

Url: https://github.com/doctrine/common/pull/256

Message:

Whilst debugging an issue I was having I found that the AnnotationDriver uses get_declared_classes() and iterates over the result to identify classes that should be handled.

This seems like a ridiculous overhead especially as it then instantiated a ReflectionClass for each declared class. As an example my current project was iterating over 522 items when it needed to only handle 6.

I've kept the alterations to a minimum but it now takes a snapshot of the declared classes before and after the require for the files and then uses array_diff to get only the classes we are targeting.



 Comments   
Comment by Marco Pivetta [ 01/Mar/13 ]

Patch breaks logic when files where already included

Comment by Benjamin Eberlei [ 01/Mar/13 ]

A related Github Pull-Request [GH-256] was closed
https://github.com/doctrine/common/pull/256





[DCOM-178] [GH-258] Add an prefix to ApcCache Created: 03/Mar/13  Updated: 03/Mar/13  Resolved: 03/Mar/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of NoUseFreak:

Url: https://github.com/doctrine/common/pull/258

Message:

In shared hosting I ran into cache-collision. This gives users the option to avoid this problem.



 Comments   
Comment by Benjamin Eberlei [ 03/Mar/13 ]

A related Github Pull-Request [GH-258] was closed
https://github.com/doctrine/common/pull/258





[DCOM-177] [GH-257] Add an prefix to ApcCache Created: 03/Mar/13  Updated: 03/Mar/13  Resolved: 03/Mar/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of NoUseFreak:

Url: https://github.com/doctrine/common/pull/257

Message:

In shared hosting I ran into cache-collision. This gives users the option to avoid this problem.



 Comments   
Comment by Benjamin Eberlei [ 03/Mar/13 ]

A related Github Pull-Request [GH-257] was closed
https://github.com/doctrine/common/pull/257





[DCOM-174] [GH-255] Hotfix/dcom 173 tests Created: 18/Feb/13  Updated: 19/Feb/13  Resolved: 18/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/common/pull/255

Message:

This PR introduces tests to avoid epic fails such as #254 and #253



 Comments   
Comment by Marco Pivetta [ 18/Feb/13 ]

Handled in DCOM-173

Comment by Benjamin Eberlei [ 19/Feb/13 ]

A related Github Pull-Request [GH-255] was closed
https://github.com/doctrine/common/pull/255





[DCOM-164] @type phpdoc annotations are not ignored (@type == @var) Created: 22/Jan/13  Updated: 06/Dec/13  Resolved: 06/Dec/13

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Matthieu Napoli Assignee: Guilherme Blanco
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

phpDocumentor guys wrote their own PSR to define how to use phpdoc properly (https://github.com/phpDocumentor/phpDocumentor2/blob/develop/docs/PSR.md).

They deprecate the @var annotation and recommend using @type instead.

The @type (phpdoc) annotation is not blacklisted/ignored by the AnnotationReader. Code that uses this annotation raises errors with Doctrine/Annotations.

@type should be blacklisted/ignored, but may that create BC breaks for users?



 Comments   
Comment by Matthieu Napoli [ 22/Jan/13 ]

PR: https://github.com/doctrine/annotations/pull/2

Comment by Guilherme Blanco [ 06/Dec/13 ]

Will not fix as phpDoc2 does not use @type anymore.





[DCOM-156] [GH-238] fix to solve fatal error: apc_exist() does not exist Created: 04/Jan/13  Updated: 02/Nov/13  Resolved: 10/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of uran1980:

Url: https://github.com/doctrine/common/pull/238

Message:

Hi, folks. I'm running *Zend Server CE 5.6.0 5.6.0 SP4* with *PHP Version 5.3.14* and APC builtin:
![2013-01-04-15-15-sshot-1](https://f.cloud.github.com/assets/1616795/43026/86d0516e-5668-11e2-8342-10972e9bb214.png)

Now when I run in my project based on Symfony 2.1.6 comand:
```
console doctrine:fixtures:load --verbose
```
I am stack with fatal error:
```
Fatal error: Call to undefined function Doctrine\Common\Cache\apc_exists()
```

![2013-01-04-15-20-sshot-1](https://f.cloud.github.com/assets/1616795/43037/742fe1f4-5669-11e2-815b-dccc9a0f4fb4.png)

*Possible solution are in my pull request.*

As I descovered I am not alone with this problem: http://stackoverflow.com/questions/9125904/apc-exist-does-not-exist(http://stackoverflow.com/questions/9125904/apc-exist-does-not-exist)



 Comments   
Comment by Benjamin Eberlei [ 10/Jan/13 ]

A related Github Pull-Request [GH-238] was closed
https://github.com/doctrine/common/pull/238

Comment by Marco Pivetta [ 10/Jan/13 ]

This issue affects older versions of APC. If a fix is needed, a legacy APC cache class shall be implemented.

Comment by Doctrine Bot [ 02/Nov/13 ]

A related Github Pull-Request [GH-238] was closed:
https://github.com/doctrine/dbal/pull/238





[DCOM-150] [GH-232] [DocParser] Don't check class exists if annotation name is ignored Created: 10/Dec/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Stroitel:

Url: https://github.com/doctrine/common/pull/232

Message:

DocParser checks for the exist of all the annotation names even if they are ignored. Maybe this is feature , but i don't sure.



 Comments   
Comment by Benjamin Eberlei [ 10/Dec/12 ]

A related Github Pull-Request [GH-232] was closed
https://github.com/doctrine/common/pull/232

Comment by Marco Pivetta [ 14/Jan/13 ]

Superseded by DCOM-151





[DCOM-139] [GH-220] replaced silence operator by is_file() check Created: 16/Nov/12  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jakoch:

Url: https://github.com/doctrine/common/pull/220

Message:






[DCOM-137] [GH-218] hotfix cache Created: 16/Nov/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jakoch:

Url: https://github.com/doctrine/common/pull/218

Message:

a) replaced silence operator by is_file() check.
If there is a lock or permission problem while unlinking a file, the error should pop up.
b) replaced little typo in constant name (availiable => available)



 Comments   
Comment by Benjamin Eberlei [ 16/Nov/12 ]

A related Github Pull-Request [GH-218] was closed
https://github.com/doctrine/common/pull/218

Comment by Marco Pivetta [ 14/Jan/13 ]

Moved to DCOM-138 and DCOM-139





[DCOM-134] [GH-213] Added sort option for array collection Created: 11/Nov/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of andrewtarry:

Url: https://github.com/doctrine/common/pull/213

Message:

I have added a sorter class and sortBy method for the ArrayCollection class. It gives the option to reorder the ArrayCollection after someone has gotten it from the database, e.g. from a relationship. It takes an array of method names to sort by in order to priority and it takes an optional boolean to set the order to ascending. Here is an example:

`$arraycollection->sortBy(array('getName()', 'getAddress()'));`

It will recursively loop the collection change the order. Each time it will look to see if the previous matching option is the same as for the previous element and then store those elements in list to be reordered.

Once it has looped all the elements it will reorder the elements it has matched and if there is another option to reorder by it will loop only the elements it matched last time so it is not looping the whole array each time.



 Comments   
Comment by Marco Pivetta [ 14/Jan/13 ]

Can't change because of BC, and the performance impact is too high





[DCOM-135] [GH-214] [WIP] [Cache] Move cache ID namespacing to CacheNamespace class Created: 12/Nov/12  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Incomplete Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of CHH:

Url: https://github.com/doctrine/common/pull/214

Message:






[DCOM-132] [GH-211] Cache interface fix Created: 01/Nov/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of szicsu:

Url: https://github.com/doctrine/common/pull/211

Message:

The CacheProvider contained more public methods,
which were not defined in the Cache interface.



 Comments   
Comment by Benjamin Eberlei [ 09/Nov/12 ]

A related Github Pull-Request [GH-211] was closed
https://github.com/doctrine/common/pull/211





[DCOM-124] [GH-203] Added deleteByPregix, deleteBySuffix, deleteByRegex in CacheProvider Created: 16/Oct/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of masarliev:

Url: https://github.com/doctrine/common/pull/203

Message:

I found that this feature is missing.






[DCOM-119] [GH-196] Make getNamespacedId protected instead of private Created: 02/Oct/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jnonon:

Url: https://github.com/doctrine/common/pull/196

Message:

We want to extend the cache class provider MemcacheCache.php in order to set a custom namespace. However, because getNamespacedId is a private method, basically a complete rewrite and code duplication of the class is needed.
Is there any reason for this method to be private instead of protected?
Thanks in advace,

--JN



 Comments   
Comment by Benjamin Eberlei [ 02/Oct/12 ]

A related Github Pull-Request [GH-196] was closed
https://github.com/doctrine/common/pull/196





[DCOM-117] [GH-194] If that $element exists give it back Created: 28/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of seltzlab:

Url: https://github.com/doctrine/common/pull/194

Message:

I think it would very useful to get back the element that matched



 Comments   
Comment by Benjamin Eberlei [ 01/Oct/12 ]

A related Github Pull-Request [GH-194] was closed
https://github.com/doctrine/common/pull/194





[DCOM-112] [GH-188] Test new3 Created: 24/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/188

Message:

trying against 2.3



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-188] was closed
https://github.com/doctrine/common/pull/188

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-188] was reopened
https://github.com/doctrine/common/pull/188

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-188] was closed
https://github.com/doctrine/common/pull/188

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-188] was reopened
https://github.com/doctrine/common/pull/188

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-188] was closed
https://github.com/doctrine/common/pull/188

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot





[DCOM-113] [GH-189] Test new3 Created: 24/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/189

Message:

last test i hope



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-189] was closed
https://github.com/doctrine/common/pull/189

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot





[DCOM-114] [GH-190] Test new3 Created: 24/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/190

Message:

something master test?



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was closed
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was reopened
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was closed
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was reopened
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was closed
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was reopened
https://github.com/doctrine/common/pull/190

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-190] was closed
https://github.com/doctrine/common/pull/190

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot





[DCOM-110] [GH-186] Test new2 Created: 24/Sep/12  Updated: 21/Nov/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/186

Message:

new pull test



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-186] was closed
https://github.com/doctrine/common/pull/186

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot

Comment by Doctrine Bot [ 21/Nov/13 ]

A related Github Pull-Request [GH-186] was closed:
https://github.com/doctrine/dbal/pull/186





[DCOM-111] [GH-187] Test new3 Created: 24/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/187

Message:

test 3



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-187] was closed
https://github.com/doctrine/common/pull/187

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-187] was reopened
https://github.com/doctrine/common/pull/187

Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-187] was closed
https://github.com/doctrine/common/pull/187

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot





[DCOM-109] [GH-185] Test new Created: 24/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of beberlei:

Url: https://github.com/doctrine/common/pull/185

Message:

test



 Comments   
Comment by Benjamin Eberlei [ 24/Sep/12 ]

A related Github Pull-Request [GH-185] was closed
https://github.com/doctrine/common/pull/185

Comment by Marco Pivetta [ 14/Jan/13 ]

Was a test for the GH bot





[DCOM-108] [GH-184] Fix bug in classExists when using multiple autoloaders (i.e. ZF2) Created: 17/Sep/12  Updated: 20/Dec/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of bramstroker:

Url: https://github.com/doctrine/common/pull/184

Message:

The autoloading routine in the classExists method makes the assumption the autoload method always returns a value (i.e. no void) when the autoloading of a class is succesfull. When you have multiple autoloaders registered to the spl stack this can lead to problems. In my case I'm using ZF2 ClassmapAutoloader and StandardAutoloader as fallback. The classmapAutoloader returns nothing so the autoload method in the StandardAutoloader is called as well, because the for loop is continued. This results in a second include, and a fatal error "Cannot redeclare class" is triggered.



 Comments   
Comment by Benjamin Eberlei [ 17/Sep/12 ]

A related Github Pull-Request [GH-184] was closed
https://github.com/doctrine/common/pull/184

Comment by Benjamin Eberlei [ 18/Sep/12 ]

A related Github Pull-Request [GH-184] was reopened
https://github.com/doctrine/common/pull/184

Comment by Marco Pivetta [ 14/Jan/13 ]

Handled in DCOM-136

Comment by Doctrine Bot [ 20/Dec/13 ]

A related Github Pull-Request [GH-184] was closed:
https://github.com/doctrine/dbal/pull/184





[DCOM-107] [GH-183] Fix bug in classExists when using multiple autoloaders (i.e. ZF2) Created: 17/Sep/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of bramstroker:

Url: https://github.com/doctrine/common/pull/183

Message:

The autoloading routine in the classExists method makes the assumption the autoload method always returns a value (i.e. no void) when the autoloading of a class is succesfull. When you have multiple autoloaders registered to the spl stack this can lead to problems. In my case I'm using ZF2 ClassmapAutoloader and StandardAutoloader as fallback. The classmapAutoloader returns nothing so the autoload method in the StandardAutoloader is called as well, because the for loop is continued. This results in a second include, and a fatal error "Cannot redeclare class" is triggered.



 Comments   
Comment by Benjamin Eberlei [ 17/Sep/12 ]

A related Github Pull-Request [GH-183] was closed
https://github.com/doctrine/common/pull/183

Comment by Marco Pivetta [ 14/Jan/13 ]

Handled in DCOM-136





[DCOM-105] Common base exception class Created: 27/Aug/12  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Till Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

Per our discussion on IRC/Twitter.

It would be nice if all exceptions thrown had a common base, so something like this is possible to catch all exceptions from Doctrine:

try {
    // some code here
} catch (\Doctrine\Common\BaseException $e) {
    // something in Doctrine threw an exception, handle it here
}

(The name is just an example.)

For reference:
https://wiki.php.net/pear/rfc/pear2_exception_policy



 Comments   
Comment by Christophe Coevoet [ 27/Aug/12 ]

Instead of a base class (which forbids extending the SPL exception), I would go the same way than Symfony2 and ZF: using an interface.

Comment by Till [ 27/Aug/12 ]

That's basically what the PEAR2 RFC is doing.

Comment by Marco Pivetta [ 21/Feb/13 ]

Duplicate of DCOM-80





[DCOM-99] Variable Support in DQL Created: 25/Apr/12  Updated: 03/Mar/14  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Masoud Mazarei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

sometimes in complex queries need to use variable,
but DQL not support Variable,



 Comments   
Comment by Marco Pivetta [ 07/Jun/12 ]

Could you please provide more information to this? Otherwise, this issue is quite invalid...

Comment by Ton Sharp [ 03/Mar/14 ]

It means Mysql User-Defined Variables
Doctrine throws "QueryException: [Syntax Error] line 0, col 10: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got '@'"

Comment by Marco Pivetta [ 03/Mar/14 ]

Yes, I've marked the issue as invalid.





[DCOM-97] phpParser.php and 'use' keyword in anonymous functions Created: 13/Feb/12  Updated: 30/Mar/12  Resolved: 30/Mar/12

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.1.4
Fix Version/s: 2.2

Type: Bug Priority: Major
Reporter: Thomas Lecarpentier Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

php 5.3, Symfony2, linux



 Description   

When i use the keyword 'use' in anonymous function (like describe in page http://php.net/manual/en/functions.anonymous.php)

Exemple :
...

/**
*

  • Extract event from all events for this day
  • @param int $year
  • @param int $month
  • @param int $day
  • @return ArrayCollection
    */
    public function getEventsForDate($year, $month, $day)
    Unknown macro: { $extractEvents = null; // check if date of item is inside day given $extractEvents = $this->events->filter( function ($item) use ($year, $month, $day) { $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); } ); return $extractEvents; }

...

The phpParser generate error

[ErrorException]
Notice: Undefined offset: -1 in /home/ent/project/Symfony/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php line 117

It try to parse 'use ($year, $month, $day)' as Class



 Comments   
Comment by Fabio B. Silva [ 25/Mar/12 ]

I think this is fixed on the php parser rewrite. (2.2)

Comment by Fabio B. Silva [ 25/Mar/12 ]

Coverage added : https://github.com/doctrine/common/commit/7ec510dbb2279f76a00ecf3f911298879c6ba1a1

I think this could be closed..

Comment by Fabio B. Silva [ 30/Mar/12 ]

Fixed on php parser rewrite. (2.2)





[DCOM-86] k-fish Created: 09/Dec/11  Updated: 30/Dec/11  Resolved: 30/Dec/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Karsten Dambekalns Assignee: Fabio B. Silva
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

When parsing a class the DocParser uses class_exists() to check for annotation classes (this triggers autoloading) - only afterwards the annotation is ignored if it should be ignored.

At least for simple unqualified names the check against the ignored annotations could be done earlier. This already goes a long way:

----- DocParser.php, at about line 555 -----
// only process names which are not fully qualified, yet
// fully qualified names must start with a \
$originalName = $name;
if ('
' !== $name[0]) {
// check early and return before further inspections
if (isset($this->ignoredAnnotationNames[$name]))

{ return FALSE; }

$alias = (false === $pos = strpos($name, '
'))? $name : substr($name, 0, $pos);

----- DocParser.php, at about line 555 -----



 Comments   
Comment by Fabio B. Silva [ 30/Dec/11 ]

Other explanations : https://github.com/doctrine/common/pull/90#issuecomment-3313175





[DCOM-72] Change CommonException to interface and use it everywhere! Created: 22/Oct/11  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Comments   
Comment by Benjamin Eberlei [ 22/Oct/11 ]

This is also necessary for everything else that accepts a class name, we should compile a list of the most important methods.

Comment by Marco Pivetta [ 21/Feb/13 ]

See DCOM-80





[DCOM-48] Autoloading with a namespace is very restricted Created: 08/Apr/11  Updated: 17/Jul/11  Resolved: 17/Jul/11

Status: Closed
Project: Doctrine Common
Component/s: Class Loading
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Matthieu Napoli Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

Sorry for the vague title of the issue, but here is the problem:

$classLoader = new ClassLoader('Tests', '/basePath/tests');

If I want to autoload \Tests\Class1, it will look for /basePath/tests/Tests/Class1.php.

I would like it to load: /basePath/tests/Class1.php. i.e., the namespace registered is removed from the path.

Do you see what I mean ? Zend Framework autoloader allow this behavior, I am surprised the Doctrine autoloader doesn't allow that.

Thanks



 Comments   
Comment by Matthieu Napoli [ 29/Apr/11 ]

Hi, any news on this ?

I'd like to know if this is going to be corrected some day, or if I should not wait for it and find another solution ?

Thank you

Comment by Guilherme Blanco [ 17/Jul/11 ]

Hi,

Zend Framework (v1) does not follow PSR-0 (http://groups.google.com/group/php-standards/web/psr-0-final-proposal) so it does whatever it wants.
Second version of Zend Framework is PSR-0 compliant, so your wish will probably fail too.

Let me explain what is the deal: Every single project, no matter what it is, can be contained in a package (aka. namespace in PHP). This means that:

library
- Controller.php
- Controller/
  - Action.php

Is plain wrong. Why? Because it's part of a project (Your app (Application), Zend, Doctrine, Symfony, etc).
Due to this, PSR-0 stricts that it only loads namespaced classes, and nothing else. It was an agreement between 18 big PHP projects, including ZF, Symfony, Lithium, CodeIgniter, etc.

Cheers,

Comment by Benjamin Eberlei [ 17/Jul/11 ]

You can use any autoloader you want for your own classes, the Doctrine one is just focused on namespaces becuse Doctrine only uses namespaces.





[DCOM-36] Declare annotation namespaces in the class' doc comment Created: 10/Feb/11  Updated: 15/Feb/11  Resolved: 15/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Kris Wallsmith Assignee: Guilherme Blanco
Resolution: Can't Fix Votes: 0
Labels: None


 Description   

I would like to declare my default annotation namespace and namespace aliases in my class' doc comment. This will ensure my class can be understood by the annotation reader regardless of its configuration.

An example of how I would use this:
https://gist.github.com/821412



 Comments   
Comment by Jonathan H. Wage [ 11/Feb/11 ]

I don't think implementing this is possible in any easy way.

Comment by Guilherme Blanco [ 15/Feb/11 ]

This cannot be done without adding a lot of WTF factor to Doctrine codebase.

For individual docblocks there's a simple way, but it is impossible to make they interchange definitions (like declare namespace on class docblock and take advantage of it on method docblock).

Marking it as can't fix, since our structure cannot support it without a complete rewrite (which would collide with our current interests).





[DCOM-35] Change AnnotationReader cache salt Created: 01/Feb/11  Updated: 15/Feb/11  Resolved: 15/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.0.1
Fix Version/s: 2.0.2

Type: Bug Priority: Major
Reporter: Guilherme Blanco Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

Our current AnnotationReader::$_CACHE_SALT conflicts with Symfony2 Console.

The solution is to change the CACHE_SALT from:

private static $CACHE_SALT = '@<Annot>';

To:

private static $CACHE_SALT = '@[Annot]';


 Comments   
Comment by Guilherme Blanco [ 15/Feb/11 ]

Fixed





[DCOM-34] calling setAutoloadAnnotationClasses on doctrine annotations reader causes fatal error Created: 08/Jan/11  Updated: 15/Feb/11  Resolved: 15/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.0.0
Fix Version/s: 2.0.2

Type: Bug Priority: Major
Reporter: Hash Panak Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Snow leopard, intel



 Description   

When I try to set setAutoloadAnnotationClasses(true) gives me a fatal error, call to undefined method

PHP Fatal error: Call to undefined method Doctrine\Common\Annotations\AnnotationReader::setAutoloadAnnotationClasses()



 Comments   
Comment by Guilherme Blanco [ 15/Feb/11 ]

The correct method name is: setAutoloadAnnotations

We need to fix the documentation of Common package.

Comment by Guilherme Blanco [ 15/Feb/11 ]

Fixed





[DCOM-30] Documentation Bug regarding setAnnotationNamespaceAlias Created: 12/Nov/10  Updated: 15/Feb/11  Resolved: 15/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Timo A. Hummel Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

In the documentation on http://www.doctrine-project.org/projects/common/2.0/docs/reference/annotations/en#setup-and-configuration:namespace-aliases I'm given the following example:

$reader->setAnnotationNamespaceAlias('MyCompany\Annotations', 'my');

However, this only works here if I do it that way:

$reader->setAnnotationNamespaceAlias('MyCompany\Annotations\\', 'my');

If the latter one is correct, it should be documented as such.



 Comments   
Comment by Guilherme Blanco [ 15/Feb/11 ]

Already fixed in documentation.





[DCOM-22] Cache should support an array of options. Created: 19/Aug/10  Updated: 30/Aug/10  Resolved: 30/Aug/10

Status: Closed
Project: Doctrine Common
Component/s: Caching
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Guilherme Blanco Assignee: Guilherme Blanco
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

Currently the overall code to instantiate Cache drivers cannot be generic.
This can be noticed when you compare APCCache and MemcacheCache drivers.

The first one is simply a no argument instantiation. The second, even after isntantiation, it still requires you to call a method (->setMemcache) in order to work.
This is not optimal for generic approaches, creating unreliable conditional situations. Also it is not extendable, allowing user to build his own driver.

Please consider these sample codes:
http://pastie.org/1103439
http://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php#L419

A suggested approach could be a CacheManager as a fatory.
Another one would be Cache interface assigning a contract to receive an array of options.

Anyway, this should be fixed VERY soon.



 Comments   
Comment by Roman S. Borschel [ 21/Aug/10 ]

After our discussion yesterday, can we close this?

Comment by Guilherme Blanco [ 30/Aug/10 ]

As discussed, we won't fix this.





[DCOM-16] Doctrine\Cache\Cache\AbstractCache::deleteByPrefix() vs. cache namespace Created: 05/Aug/10  Updated: 31/Aug/10  Resolved: 31/Aug/10

Status: Closed
Project: Doctrine Common
Component/s: Caching
Affects Version/s: 2.0.0-BETA2, 2.0.0-BETA3, 2.0.0-BETA4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: xlite Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None
Environment:

PHP 5.3.0 + memcache + xdebug; FreeBSD 6.4-RELEASE-p



 Description   

The methods deleteByPrefix() / deleteByRegExp() / deleteBySuffix() are based on the method getIds(), which returns unique identifiers with an added namespace in the front. That is why to be able to delete cells using these three methods, you have to know the namespace.
Example:

$cacheDriver->setNamespace('ns');
$cacheDriver->save('data', 'name');
$cacheDriver->deleteByPrefix('data');

In this example the cell will not be deleted.



 Comments   
Comment by Guilherme Blanco [ 31/Aug/10 ]

In commit: http://github.com/doctrine/common/commit/a2238b871c13cf0e195fa18f0b8744e38baabf48
I committed a fix to this issue.

Thanks for reporting that!





[DCOM-14] Exclude @throws annotation from parsing. Created: 21/Jul/10  Updated: 31/Aug/10  Resolved: 31/Aug/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jan ObrĂ¡til Assignee: Roman S. Borschel
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

Ubuntu Linux 10.04 LTS Server, standard lamp instalation from repositories
w$ php -v
PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:01:00)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies



 Description   

CLI doctrine tool fails when parsing entity sources (for example: doctrine orm:validate-schema) by following error:
Fatal error: Class 'throws\MemberAccessException' not found in /usr/share/php/Doctrine/Common/Annotations/Parser.php on line 272
exception 'FatalErrorException' with message 'Class 'throws\MemberAccessException' not found' in /usr/share/php/Doctrine/Common/Annotations/Parser.php:272

This error appears when @HasLifecycleCallbacks annotation is added into entity.

The solution is adding "@throws" annotation into strippedTags into Doctrine/Common/Annotations/Parser.php



 Comments   
Comment by Roman S. Borschel [ 26/Aug/10 ]

Can you confirm that this is still a problem with the latest code?

Comment by Jan ObrĂ¡til [ 27/Aug/10 ]

I'm using the latest Doctrine2 available thru pear:

Installed packages, channel pear.doctrine-project.org:
======================================================
Package Version State
DoctrineCommon 2.0.0BETA4 beta
DoctrineDBAL 2.0.0BETA3 beta
DoctrineORM 2.0.0BETA3 beta

I still have to alter Parser.php

Comment by Guilherme Blanco [ 31/Aug/10 ]

This ticket is invalid. I added coverage to it on commit:

http://github.com/doctrine/common/commit/7e7a06e9878a1a41a72a062fa18d71d6c64a600a

Seems you have a @throws definition that is connected to the returned class, and this is then considered an annotation.





[DCOM-10] The annotation parser isn't EBNF compliant Created: 04/Jul/10  Updated: 16/Feb/11  Resolved: 16/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.0.0-BETA4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Bernhard Schussek Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None
Environment:

PHP 5.3.2, Linux Ubuntu 10.04



 Description   

The EBNF allows passing multiple comma-separated annotations to an annotation:

Annotation ::= "@" AnnotationName ["(" [Values] ")"]
Values ::= Array | Value {"," Value}*
Value ::= PlainValue | FieldAssignment
PlainValue ::= integer | string | float | boolean | Array | Annotation

Therefore the following should be possible.

/** @Name(@Foo, @Bar) */

This results in an error though.

IMO,

/** @Name(@Foo, @Bar) */

should be equivalent to

/** @Name({@Foo, @Bar}) */

just like

/** @Name(foo = "foo", bar = "bar") */

is equivalent to

/** @Name({foo = "foo", bar = "bar"}) */


 Comments   
Comment by Bernhard Schussek [ 04/Jul/10 ]

Fixed in http://github.com/bschussek/doctrine-common/tree/DCOM-10

Comment by Bernhard Schussek [ 04/Jul/10 ]

As I've just noticed, the statement that

/** @Name(foo = "foo", bar = "bar") */

equals

/** @Name({foo = "foo", bar = "bar"}) */

is wrong. The first does field assignments, the second stores the array in the "value" field.

Nevertheless, either Doctrine's implementation (as per my commit) or the EBNF have to be updated.

Comment by Guilherme Blanco [ 15/Feb/11 ]

Your branch added another vulnerability, so I cannot merge.

The problem appears when you do this:

@Name(@Foo, {bar="bar"})

What would you expect on this situation? I'd imagine this:

array(
    0 => object<Foo>,
    1 => array(
        'bar' => 'bar'
    )
)

But with your patch, the actual result is:

array(
    0 => object<Foo>,
    'bar' => 'bar'
)

There's a way to fix it by changing how FieldAssignment returns. Instead of returning an array, it should return return an stdClass.
Then we could only update the Values grammar accordingly.

I'll assign this issue to me, so I can work on it to be EBNF compatible. Too bad it took so many time for us to look at it. =(

Comment by Bernhard Schussek [ 16/Feb/11 ]

Yes, I'd expect the first result. Thanks for looking into this, I completely forgot about this issue.

Comment by Guilherme Blanco [ 16/Feb/11 ]

This issue was fixed in: https://github.com/doctrine/common/commit/4210fbd8b261c000c793461c4f815b4d43bcc362

Thanks a lot for the bug report.
EBNF and Code are now compliant with each other. Took some time to be fixed, but here it is. =)





[DCOM-8] Annotation Parser tries to Load Classes that don't exist Created: 14/Jun/10  Updated: 14/Jun/10  Resolved: 14/Jun/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: 2.0.0-BETA2
Fix Version/s: 2.0.0-BETA3

Type: Bug Priority: Major
Reporter: Marc Neuhaus Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File Error.txt     File Possible Solution.diff     File Tag.php    

 Description   

If i add the Annotation Tag @ignore to my model the Parser tries to load the Mapping class for that property. Since this class doesn't exist it fails with a fatal error.

I attached the stripped down Entity with the @ignore annotation, the Error Text and a Possible Solution

Greetings Marc



 Comments   
Comment by Roman S. Borschel [ 14/Jun/10 ]

Fixed in http://github.com/doctrine/common/commit/f34d581f646b3d9b5f06c6c081ac3e568d8496ff





[DCOM-4] Cannot use namespace separator and namespace alias at the same time for annotations Created: 09/May/10  Updated: 24/May/10  Resolved: 24/May/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0-BETA2

Type: Improvement Priority: Major
Reporter: Tim Nagel Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None


 Description   

In the function Annotation() in \Doctrine\Common\Annotations\Parser.php (~line 225)

There is a check for how many $nameParts there are, and the doctrine code will only append the namespace aliases if there are no namespace separators.

There is also an argument against modification since the user of the code could just define more namespace aliases, but I feel that it should be able to cope with a namespace alias and a namespace separator at the same time.



 Comments   
Comment by Benjamin Eberlei [ 09/May/10 ]

From our discussion on IRC, the problems here are:

  • Annotations that don't have classes don't really throw an appropriate exception (error message)
  • The \ separator inside an annotation does not throw an appropriate exception.
Comment by Tim Nagel [ 24/May/10 ]

Proposed solution to the namespace separators: http://github.com/merk/common/commit/b31166c6a85235e03935a4b41f5a54aa478f6c6b

I am unsure about throwing exception messages or doing anything too fancy in this area since there will be instances where other annotations are used for other purposes (phpdoc, etc) where you only want to ignore them.





[DCOM-2] Annotation and autoloading Created: 20/Apr/10  Updated: 14/Jun/10  Resolved: 14/Jun/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0-BETA3

Type: Improvement Priority: Major
Reporter: Kirill chEbba Chebunin Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None


 Description   

The problem is that we need to load all annnotation classes before we read annotations from the target class.
So we need to require_once them at target class source, or just before reading.
It's not cool.

The reason of this, is a fix of bug #77
http://www.doctrine-project.org/jira/browse/DDC-77
and class_exists(..., false).

Solutions:
1. Filter DocBlockTags, and think that all other @foo string is annotations (don't check with class_exists)
2. Use class_exists(..., true) but supress warnings with @ and try/catch operators.

May be there are some another, better solutions.



 Comments   
Comment by Roman S. Borschel [ 22/Apr/10 ]

The class_exists check can maybe be removed altogether since is_subclass_of is no longer used.

Comment by Tim Nagel [ 24/May/10 ]

Would removing the second parameter to class_exists solve the problem sufficiently?

I would thing you would have to leave the class_exists check in, otherwise it will try to parse annotations that do not resolve to class names?

Comment by Tim Nagel [ 27/May/10 ]

Changed:

http://github.com/merk/common/commit/152fdecf11b7999262df0410b5584951de5191b3

Comment by Roman S. Borschel [ 27/May/10 ]

The fundamental problem with class_exists($blub) (which is the same as class_exists($blub, true) is that it basically requires a class loader / autoloader that fails silently when a class file does not exist, which means it must use costly file_exists checks before loading any class. The Doctrine\Common\ClassLoader does (on purpose) not check for file existance. If the class loader is responsible for a particular class and it is requested to load it, failing to do so is (and should be) a fatal error.

We consider the fact that two responsibilities are mixed here, a) (auto)loading a class file and b) checking for the existance of a class (file), to be a design flaw in class_exists / autoloading. It means that you are required to check for file existance in a class loader and fail silently if the file does not exist which is completely unnecessary in 99% of the cases. Compare how many times class_exists(..., true) is usually used in a single request and how many classes, in total, are usually loaded per request. So just for the case that some code might use an occasional class_exists(..., true) check you have to check each single file for existance before loading it (and you must fail silently, it might be a class_exists check!).

Even more, in a case where you really only want to check for class (file) existance, but you dont actually want to load it, you can't! class_exists(..., true) when the class file exists results in loading the class file, even if its completely unnecessary.

We are planning to come up with a better approach that separates the 2 concerns.

This is related to DCOM-7.

Comment by Roman S. Borschel [ 27/May/10 ]

The recommended approach for annotations by the way, (recommended by me), is to load them manually via a require call. The ORM does exactly this. If you rely on class_exists(..., true) and silently failing autoloaders, this becomes costly considering how often class_exists would be invoked while parsing annotations.





[DCOM-75] remove leading backslash from class name before comparing to namespace in annotation autoloading Created: 03/Nov/11  Updated: 06/Dec/13  Resolved: 06/Dec/13

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.1.2
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Guillaume ORIOL Assignee: Guilherme Blanco
Resolution: Invalid Votes: 0
Labels: None
Environment:

not relevant



 Description   

I am figuring a problem with Symfony Validator constraints (I use annotations to define the constraint rules).

As I don't use Symfony's framework, I create the validator service by myself.
Somewhere in its factory, I put the following code:

         
AnnotationRegistry::registerAutoloadNamespaces(array(
    '\Symfony\Component\Validator\Constraints' => APPLICATION_ROOT . '/library'
));

Then, in my entities, I have annotations such as:

use Symfony\Component\Validator\Constraints as Assert;

class Author {
    /**
     * @Assert\NotBlank()
     */
    protected $name;
}

In this configuration, I get the following error:

[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\NotBlank"
in property Domain\Entity\Author::$name does not exist, or could not be auto-loaded.

I was able to trace it down to the Doctrine\Common\Annotations\AnnotationRegistry#loadAnnotationClass($class) where we can find the following test:

    if (strpos($class, $namespace) === 0) {
        require ...;
    }

which means "if the namespace can be found at the beginning of the FQCN, require it".
But those namespaces come from "use" statements where there is no leading backslash.
That's why the test fails.

Christophe Coevoet answered:

you should remove the leading backslash. Fully qualified class names used as string don't include it in PHP.

Benjamin Eberlei suggested to remove the leading backslash before comparing the class to the namespace.
I would follow Benjamin suggestion and would like to add a comment about leading backslashes:

When I add a use statement to my code for a class, I can then use its alias to get an instance of that class.

use Doctrine\ORM\Mapping\ClassMetadata;
...
$metadata = new ClassMetadata();

The same is true with:

use Doctrine\ORM\Mapping as Foo;
...
$metadata = new Foo\ClassMetadata();

This is not a fully qualified class name.
In that sense, I do understand such an annotation: @ORM\Entity.

But I find the syntax of a fully-qualified annotation (@My\Annotation\Whatever) erroneous (or at least counter-intuitive) as it doesn't start with a backslash.



 Comments   
Comment by Guilherme Blanco [ 06/Dec/13 ]

Your referred problem is an internal namespace => directory mapping.
Strings in PHP already represent FQCN and that's why you shouldn't have a leading backslash in your string.

This has nothing to do with annotations.





[DCOM-24] Documentation about Default Namespace has error. Created: 25/Sep/10  Updated: 15/Feb/11  Resolved: 15/Feb/11

Status: Closed
Project: Doctrine Common
Component/s: Annotations
Affects Version/s: 2.0.0-RC1
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Margus Sipria Assignee: Guilherme Blanco
Resolution: Invalid Votes: 0
Labels: None


 Description   

$reader->setDefaultAnnotationNamespace('Doctrine\Common\Annotations');

I used above code to test annotations without namespaces just to find out that there there is missing \ (or 2 if you count escaping) at the end of that string.

This works: $reader->setDefaultAnnotationNamespace('Doctrine\\Common\\Annotations
');

reference guide where I found error is here: http://www.doctrine-project.org/projects/common/2.0/docs/reference/annotations/en#setup-and-configuration:default-namespace



 Comments   
Comment by Guilherme Blanco [ 15/Feb/11 ]

Already fixed on documentation.





[DCOM-7] Slight Refactor of ClassLoader Created: 06/May/10  Updated: 13/Jun/10  Resolved: 13/Jun/10

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0-BETA2

Type: Improvement Priority: Minor
Reporter: Michael Ridgway Assignee: Roman S. Borschel
Resolution: Fixed Votes: 0
Labels: None

Attachments: File patch.diff    

 Description   

This is a rather trivial issue: I'd like to add a function to the Common\ClassLoader called getClassPath($className) or something named similarly so that we are able to find where an autoloader will look for the specified class. The autoloader doesn't check for file existence normally (as it shouldn't) but there are cases where the developer does need to make sure that the file exists before a class is attempted to be loaded.

I've attached a patch for the changes that I'm proposing.



 Comments   
Comment by Roman S. Borschel [ 06/May/10 ]

We have another idea for these issues (basically for the issue of using class_exists(..., true) and your new method may even complement this nicely. I will let you know what I mean here soon.

Comment by Roman S. Borschel [ 13/Jun/10 ]

There is now ClassLoader#classExists as well as ClassLoader#getClassLoader available.





[DCOM-42] Sort in ArrayCollection Created: 22/Mar/11  Updated: 17/Jul/11  Resolved: 17/Jul/11

Status: Closed
Project: Doctrine Common
Component/s: Collections
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial
Reporter: Thomas Lundquist Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

Needed a sort function in ArrayCollection, made it. Simple but works for me at least.

Pull request: https://github.com/doctrine/common/pull/12



 Comments   
Comment by Guilherme Blanco [ 17/Jul/11 ]

As per github comment.





Generated at Fri Aug 29 05:31:05 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.