[DCOM-234] Cache file fails on Windows - name too long Created: 19/Feb/14  Updated: 19/Feb/14

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

Type: Bug Priority: Critical
Reporter: Matt Durak Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 8.1 x64
Symfony CMF with Doctrine caching



 Description   

The filename component of the FileCache is unbounded. It is possible to attempt to create files that are too long for the Windows filesystem. This causes an exception.

Example from a Symfony CMF/PHPCR project:

file_put_contents(D:\web_workspace\study\app\cache\dev\doctrine\cache\71d059fe39968db8\3e485dbb27419897\dfb24337887ff42c\a7b85c70bfefa781\nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].doctrinecache.data): failed to open stream: Invalid argument in D:\web_workspace\study\vendor\doctrine\cache\lib\Doctrine\Common\Cache\FilesystemCache.php line 111

In this case, the ID was
"nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].doctrinecache.data"

That refers to a phpcr node:
cms/program/pages/The Summer Program/The Calendar 5 weeks for all Europe

Attempting to manually create that file in windows explorer shows that it is trunacted to
"nodes[nodes weak references cmsprogrampagesThe Summer ProgramThe Calendar 5 weeks for all Europe, routeContent, default][49].do" (128 characters)

Shouldn't the ID be truncated so this doesn't happen? Should this be fixed here or in the phpcr that is creating the long ID to begin with?






[DCOM-239] [GH-319] Add last modified time for metadata Created: 22/Mar/14  Updated: 22/Mar/14

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

This PR is part 1 of 2. Part 1 is for the doctrine/doctrine2 repository.

Read more in https://github.com/doctrine/doctrine2/pull/986






[DCOM-232] [GH-315] Ability to use alternate dump functions Created: 04/Feb/14  Updated: 04/Feb/14

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

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

In most cases functions such as print_r provide much more readable output than var_dump. Some might also want to use var_export or write their own dump function. This should be a simple change that does not cause any BC breaks.






[DCOM-203] Ability to set defaultManager on ManagerRegistry Created: 21/Jun/13  Updated: 21/Jun/13

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

Type: Improvement Priority: Major
Reporter: Daniel Leech Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We (in the CMF) need to be able to change the "default manager" name at runtime, to enable switching, for example, between Production and Staging workspaces.

This is currently not possible because defaultManager is private and there is no setter.

See: https://github.com/doctrine/DoctrinePHPCRBundle/issues/73






[DCOM-184] [GH-266] Add a new method to use a filter before extracting the metadata Created: 12/Mar/13  Updated: 23/Dec/13

Status: Open
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: Unresolved Votes: 1
Labels: None


 Description   

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

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

Message:

Hi

I have notice that, when you use the doctrine:mapping:convert and doctrine:mapping:import command in symfony, the filter is added after all the metadata are extracting from the database.
In this case, when you have a table with no primary key for example, you cannot extract the mapping for only one entity.

I have also made a pull-request into the doctrineBundle and doctrine2 to fix this issue.
https://github.com/doctrine/DoctrineBundle/pull/161
https://github.com/doctrine/doctrine2/pull/603

What are your thought about my issue?



 Comments   
Comment by Doctrine Bot [ 23/Dec/13 ]

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





[DCOM-160] [GH-242] adds a simple manager registry Created: 10/Jan/13  Updated: 10/Jan/13

Status: Open
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: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

This registry adds some sane defaults and just requires a simple callable to be fully functional.






[DCOM-161] [GH-243] Update composer.json Created: 11/Jan/13  Updated: 23/Dec/13

Status: Open
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: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

Add `provide` part as `doctrine/common` >=2.2,<2.4 has cache in it.



 Comments   
Comment by Doctrine Bot [ 23/Dec/13 ]

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





[DCOM-152] [GH-234] Criteria filtering doesn't work with DateTime instance Created: 17/Dec/12  Updated: 03/Feb/14

Status: Awaiting Feedback
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: Unresolved Votes: 0
Labels: None


 Description   

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

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

Message:

Filtering associations doesn't work with DateTime instance as a comparison value because filtering uses === operator. It works with SQL backed filtering, but not on PHP collection level.

```php
$criteria = Criteria::create()
>where(Criteria::expr()>eq("birthday", new \DateTime("1982-02-17")))
->orderBy(array("username" => "ASC"))
->setFirstResult(0)
->setMaxResults(20)
;
```



 Comments   
Comment by Doctrine Bot [ 03/Feb/14 ]

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





[DCOM-151] [GH-233] [DocParser] Fix trying include classes if its must be ignored. Created: 10/Dec/12  Updated: 03/Dec/13

Status: Open
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: Unresolved 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/233

Message:

I recreate pull request (add test). Without fix test is failure.



 Comments   
Comment by Doctrine Bot [ 03/Dec/13 ]

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

Comment by Marco Pivetta [ 03/Dec/13 ]

Provided a cleaned up version at https://github.com/doctrine/annotations/pull/18





[DCOM-80] Add common exceptions into Doctrine\Common Created: 19/Nov/11  Updated: 20/Dec/11

Status: Open
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: Unresolved Votes: 0
Labels: None


 Description   

Following the ZF and SF2 Standard for Exceptions we should have base exceptions in Common






[DCOM-77] add a method to force removal of any unmapped data on flush for a given object Created: 16/Nov/11  Updated: 16/Nov/11

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

Type: New Feature Priority: Major
Reporter: Lukas Kahwe Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

in order to ensure that any unmapped fields are set to their defaults or removed in the case of nosql right now there is no way to do this except with 2 flush calls: aka remove+flush, persist+flush

there should be some way to do this in one flush






[DCOM-67] Introduce immutable DateTime with __toString() Created: 27/Aug/11  Updated: 29/Jan/12

Status: Reopened
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: Unresolved Votes: 0
Labels: None


 Comments   
Comment by Benjamin Eberlei [ 27/Aug/11 ]

Implemented

Comment by Koji Ando [ 11/Jan/12 ]

Though it is implemented once on https://github.com/doctrine/common/commit/7140ad3ba0ba2a94238976dd7f310ff92b478c96,
the class is removed on https://github.com/doctrine/common/commit/f845c1e267abf9069422eba8addfa976bc8d8685.

I think this issue must be reopened.

Comment by Benjamin Eberlei [ 11/Jan/12 ]

Code was removed due to implementation problems.





[DCOM-33] Allow to register callbacks in the EventManager Created: 01/Jan/11  Updated: 01/Jan/11

Status: Open
Project: Doctrine Common
Component/s: Event System
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Comments   
Comment by Benjamin Eberlei [ 01/Jan/11 ]

Consider to add a second queue for callbacks. Its not possible to simulate this by doing something like:

public function addCallbackListener($event, Closure $callback)
{
    $eventListener = new stdClass();
    $eventListener->$event = $callback;
    $this->addEventListener($event, $eventListener);
}

sad





[DCOM-74] Ideas for Event Manager Improvements Created: 31/Oct/11  Updated: 21/Apr/14

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

Type: Improvement Priority: Major
Reporter: Johannes Schmitt Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I have two ideas for improving the event manager.

1. Add a lazy-loading implementation as we discussed on IRC already (helpful for keeping the overhead of post generation schema listener down for example)
2. Providing better debugging information of what is going on (which listeners have been called for which event, similar to Symfony2's event dispatcher)



 Comments   
Comment by Guilherme Blanco [ 16/Jan/12 ]

I'm still a huge fan of DOM2 Events.

I even have the code somewhere here, but that would break BC.

Comment by Marijn Huizendveld [ 06/Feb/13 ]

Would you care to elaborate on your DOM2 Events implementation Guilherme?

Comment by Guilherme Blanco [ 21/Apr/14 ]

Marijn Huizendveld sure (like... 1 year later!)
DOM2 Events ( http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/ )
The idea is to create an event system where you can control the flow over the listeners, such as prevent the default operation or stop propagation.
I'm a big fan of this because that way any piece can be easily decoupled from the base system and become a specialized event if needed. It also can be controlled depending on the conditions to be introspected by an specific listener.





[DCOM-238] FileCache does not remove directories on flush Created: 21/Mar/14  Updated: 21/Mar/14

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

Type: Bug Priority: Minor
Reporter: Ryan Korczykowski Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 7



 Description   

FileCache::doFlush() does not remove the directories that store the cache file. The cache file is correctly deleted. This results in hundreds of hanging directories when the cache is flushed / rebuilt.

The version of doctrine/cache is 1.3.0.



 Comments   
Comment by Marco Pivetta [ 21/Mar/14 ]

This is likely because of the iterator skipping directories:

https://github.com/doctrine/cache/blob/36c4eee5051629524389da376ba270f15765e49f/lib/Doctrine/Common/Cache/FileCache.php#L120-L122





[DCOM-233] Support for class constant annotations Created: 05/Feb/14  Updated: 05/Feb/14

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

Type: New Feature Priority: Minor
Reporter: Steve Müller Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I need to read annotations for class constants which currently is not possible. Obviously there is a good reason for that because PHP lacks a native ReflectionConstant class. Still sometimes this would be really useful and there are custom reflection implementation out there such as the PHP-Token-Reflection library (https://github.com/Andrewsville/PHP-Token-Reflection) which provide a class for that purpose.
Now the problem is that there is no way to extend the annotation reader to add support for this purpose without having to duplicate a lot of code. This is due to the annotation parser being private in the annotation reader and Doctrine not providing a Target::TARGET_CONSTANT.
If we could decide on supporting this, there are two options IMO:

1. Provide a ReflectionConstant interface in the core and add getConstantAnnotation(ReflectionConstant $constant, $annotationName) and getConstantAnnotations(ReflectionConstant $constant) to the Reader interface in conjunction with an AbstractReader class to throw an exception when calling those methods (to preserve BC).

2. Extend AnnotationReader to provide a final protected getParser() method for better extensibility so that one can subclass the annotation reader without heavy code duplication.

In both cases an addition of Target::TARGET_CONSTANT would desirable.

Currently I have to workaround this is in a very ugly manner by extending \ReflectionClass to access ReflectionConstant objects provided by PHP-Token-Reflection library and wrapping them into objects that emulate \ReflectionProperty, just to be able to use the annotation reader.

Do you think there is any solution to this which we can provide in Doctrine annotations lib?






[DCOM-224] If @ManyToOne targetEntity contains class name with double slashes, "Cannot redeclare class" error is raised Created: 30/Nov/13  Updated: 14/Dec/13

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

Type: Improvement Priority: Minor
Reporter: Ville Mattila Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If @ManyToOne (and apparently any other association annotation) contains targetEntity with "wrongly" defined fully qualified class name in format like My\\Entity
Class, Fatal error "Cannot redeclare class" is raised when running command to generate schema.

It would be more intuitive (and save some debugging hours if a proper exception of wrongly defined class name would be raised.



 Comments   
Comment by Luis Cordova [ 14/Dec/13 ]

i haven't tried annotations yet but in yml and on master this gives me:

[Doctrine\ORM\Mapping\MappingException]
The target-entity Acme\DemoBundle\Entity\UserX cannot be found in 'Acme\DemoBundle\Entity\Category#users
'.

let me try annotations ...

Comment by Luis Cordova [ 14/Dec/13 ]

yeah this should be pretty much closed @ocramius @beberlei

Comment by Luis Cordova [ 14/Dec/13 ]

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L945

Comment by Marco Pivetta [ 14/Dec/13 ]

Copied comment from 2844:

The issue should try to create a mapping of the kind

@ManyToOne(targetEntity="Foo\\Bar")

explicitly using two backslashes in the namespace seperator and try if an error occurs. This might be autoloader and Operating System dependent. Even if there is no error, we should fix "Doctrine\ORM\Mapping\ClassMetadataInfo" to replace double backslashes everywhere with one backslash correctly. This affects targetEntity and DiscrimnatorMap.

Comment by Marco Pivetta [ 14/Dec/13 ]

I'd rather throw an exception to warn the user about the abuse of backslashes.

Comment by Marco Pivetta [ 14/Dec/13 ]

Moved to doctrine common, since it's an issue with how metadata is being loaded when referenced

Comment by Marco Pivetta [ 14/Dec/13 ]

Provided a hotfix at https://github.com/doctrine/common/pull/309





[DCOM-214] Collection Criteria isNull does not work well Created: 12/Sep/13  Updated: 12/Sep/13

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

Type: Bug Priority: Minor
Reporter: Jan Pecek Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: collection, criteria, expression
Environment:

PHP 5.4.4, PostgreSQL 9.1



 Description   

I'm using the Collection project https://github.com/doctrine/collections and its Criteria building part. I'm not sure if I'm putting this bug to the good project. Please, correct me if not.

There is bug in method isNull: https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/ExpressionBuilder.php#L125

This produces SQL command where is 'IS ?' and null value is passed as param. This is fail.

Code example:

  $expr = Criteria::expr();
  $criteria = Criteria::create()
	->where($expr->lte('num', 42))
	->andWhere($expr->isNull('deleted'));
  return $this->myCollection->matching($criteria);

This produces SQL:

 SELECT ... FROM ... WHERE num <= ? AND deleted IS ? 

with params

[ 42, null ]





[DCOM-205] Missing filenames from exception messages Created: 01/Jul/13  Updated: 01/Jul/13

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

Type: Improvement Priority: Minor
Reporter: Igor Wiedler Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   
  • Doctrine\Common\Persistence\Mapping\MappingException
  • "File mapping drivers must have a valid directory path, however the given path seems to be incorrect!"

This would be more helpful if it included a path name. There are probably other similar exceptions affected as well, so you might want to adjust others too.






[DCOM-191] Wrong inflection for "identity" Created: 07/May/13  Updated: 07/May/13

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

Type: Bug Priority: Minor
Reporter: Tom Vogt Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS X and Linux, PHP 5.4.x



 Description   

console doctrine:generate:entities

For an association named "identities", the code generator creates the two methods
addIdentitie() and removeIdentitie() - apparently the inflector doesn't catch that it should be addIdentity and removeIdentity.






[DCOM-168] ignoredAnnotationNames doesn't work in Annotation loop Created: 27/Jan/13  Updated: 27/Jan/13

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

Type: Bug Priority: Minor
Reporter: James S Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Mac OSX 10.6.8



 Description   

I'm just starting out with Doctrine, so my setup is a bit messy, but hopefully someone can figure out what is relevant from all my code.

Basically, I'm using Annotations on Doctrine ORM, and am integrating with Gedmo for several of their extensions.

I can run the CLI tool and update the schema, but when running via my web server, I'm getting the following error:

object(Doctrine\Common\Annotations\AnnotationException)[150]
  protected 'message' => string '[Semantical Error] The annotation "@Entity" in class Innertube\Models\Device was never imported. Did you maybe forget to add a "use" statement for this annotation?' (length=163)
  private 'string' (Exception) => string '' (length=0)
  protected 'code' => int 0
  protected 'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php' (length=211)
  protected 'line' => int 52
  private 'trace' (Exception) => 
    array
      0 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php' (length=201)
          'line' => int 592
          'function' => string 'semanticalError' (length=15)
          'class' => string 'Doctrine\Common\Annotations\AnnotationException' (length=47)
          'type' => string '::' (length=2)
          'args' => 
            array
              ...
      1 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php' (length=201)
          'line' => int 533
          'function' => string 'Annotation' (length=10)
          'class' => string 'Doctrine\Common\Annotations\DocParser' (length=37)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      2 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php' (length=201)
          'line' => int 297
          'function' => string 'Annotations' (length=11)
          'class' => string 'Doctrine\Common\Annotations\DocParser' (length=37)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      3 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php' (length=208)
          'line' => int 151
          'function' => string 'parse' (length=5)
          'class' => string 'Doctrine\Common\Annotations\DocParser' (length=37)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      4 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php' (length=204)
          'line' => int 86
          'function' => string 'getClassAnnotations' (length=19)
          'class' => string 'Doctrine\Common\Annotations\AnnotationReader' (length=44)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      5 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php' (length=205)
          'line' => int 61
          'function' => string 'getClassAnnotations' (length=19)
          'class' => string 'Doctrine\Common\Annotations\CachedReader' (length=40)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      6 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php' (length=202)
          'line' => int 112
          'function' => string 'loadMetadataForClass' (length=20)
          'class' => string 'Doctrine\ORM\Mapping\Driver\AnnotationDriver' (length=44)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      7 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php' (length=228)
          'line' => int 302
          'function' => string 'doLoadMetadata' (length=14)
          'class' => string 'Doctrine\ORM\Mapping\ClassMetadataFactory' (length=41)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      8 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php' (length=228)
          'line' => int 205
          'function' => string 'loadMetadata' (length=12)
          'class' => string 'Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory' (length=64)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      9 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/orm/lib/Doctrine/ORM/EntityManager.php' (length=187)
          'line' => int 268
          'function' => string 'getMetadataFor' (length=14)
          'class' => string 'Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory' (length=64)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      10 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/libraries/lerteco_framework/libraries/vendor-composer/doctrine/orm/lib/Doctrine/ORM/EntityManager.php' (length=187)
          'line' => int 682
          'function' => string 'getClassMetadata' (length=16)
          'class' => string 'Doctrine\ORM\EntityManager' (length=26)
          'type' => string '->' (length=2)
          'args' => 
            array
              ...
      11 => 
        array
          'file' => string '/Users/jshannon/Documents/Work/Projects/InnerTube/Repo/web/packages/lerteco_innertube/api/routes/devices.php' (length=108)
          'line' => int 16
          'function' => string 'getRepository' (length=13)
          'class' => string 'Doctrine\ORM\EntityManager' (length=26)

The call that initiates this is getRepository(), which IS NOT in the CLI.

I've tracked it down to the fact that DocParser is not getting the list of names to ignore.

Oddly, it gets it the first time that it's called by AnnotationReader. However, DocParser->parse() calls $this->Annotations(), which calls $this->Annotation(), calls $this->collectAnnotationMetadata(), which then creates a new parser

self::$metadataParser = new self();

and eventually parses it

self::$metadataParser->parse()

, but DOES NOT pass its ignorednames.

This seems like an oversight, but it clearly works for a lot of people. My configuration code is:

                if (self::$isDevMode) {
			$cache = new \Doctrine\Common\Cache\ArrayCache;
		} else {
			$cache = new \Doctrine\Common\Cache\ApcCache;
		}

		\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName('package');

		AnnotationRegistry::registerFile(__DIR__ . "/vendor-composer/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
		\Gedmo\DoctrineExtensions::registerAnnotations();

		

		$annotationReader = new \Doctrine\Common\Annotations\AnnotationReader();
		$cachedAnnotationReader = new \Doctrine\Common\Annotations\CachedReader($annotationReader, $cache);



		$annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($cachedAnnotationReader, self::$namespaceArray);

		$config = new \Doctrine\ORM\Configuration;
		$config->setProxyNamespace('Proxy');
		$config->setAutoGenerateProxyClasses(self::$isDevMode); // this can be based on production config.
		// register metadata driver
		$config->setMetadataDriverImpl($annotationDriver);
		// use our allready initialized cache driver
		$config->setMetadataCacheImpl($cache);
		$config->setQueryCacheImpl($cache);

		if (defined('DIR_FILES_CACHE')) {
			$config->setProxyDir(DIR_FILES_CACHE);
		} else {
			$config->setProxyDir(sys_get_temp_dir());
		}

		// create event manager and hook prefered extension listeners
		$evm = new \Doctrine\Common\EventManager();

		$prefix = new TablePrefix(null);
		$prefix->useNamespace(true);
		$evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $prefix);


		$blameableListener = new \Gedmo\Blameable\BlameableListener();
		$blameableListener->setAnnotationReader($config->getMetadataDriverImpl()->getReader());
		//class_exists makes this usable with the command-line
		if (class_exists('\User') && ($u = new \User()) != false) {
			$blameableListener->setUserValue($u->getUserID());
		}
		$evm->addEventSubscriber($blameableListener);


		$timestampableListener = new \Gedmo\Timestampable\TimestampableListener();
		$timestampableListener->setAnnotationReader($config->getMetadataDriverImpl()->getReader());
		$evm->addEventSubscriber($timestampableListener);

		$config->addFilter('soft-deleteable', '\Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter');


		return EntityManager::create($connectionOptions, $config, $evm);

and the entity is (which sets up the repository) is:

namespace Innertube\Models;
defined('C5_EXECUTE') or die('Access Denied.');

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @ORM\Entity(repositoryClass="DeviceRepository") @ORM\Table(name="Devices")
 * @Gedmo\SoftDeleteable(fieldName="deletedOn")
 **/
class Device {

and the repository is:

namespace Innertube\Models;
defined('C5_EXECUTE') or die('Access Denied.');

use Doctrine\ORM\EntityRepository;

class DeviceRepository extends EntityRepository {





[DCOM-130] Paths in Doctrine\Common\Cache\FileCache could create large directory indexes Created: 23/Oct/12  Updated: 05/Jul/13

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

Type: Bug Priority: Minor
Reporter: R Churchill Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Any



 Description   

The way paths are created within FileCache currently, there is a theoretical maximum of 16^12 directories in the cache directory, which is quite a large number. Usually schemes like this are used to restrict the number of files in one directory.

Comparing with git, for example, the dirs are arranged

00/
1c/
...
ff/

and then the object store within those directories, which is a lot more manageable, say if you happen to type ls in the cache directory, you will get a maximum listing of 256 dirs. PhpThumb does something similar when caching images.

How about something like this for getFilename():

$idHash = md5($id);
$path = substr($idHash, 0, 2) . DIRECTORY_SEPARATOR . substr($idHash, 2, 2) . DIRECTORY_SEPARATOR . substr($idHash, 4);
$path = $this->directory . DIRECTORY_SEPARATOR . $path;

return $path . $id . $this->extension;

Not nearly so elegant, but I think this has better properties for the file system. Also I would be tempted to use one of the sha family hashes and not to include the $id within the filename, but perhaps this is helpful for debugging?



 Comments   
Comment by Julian Higman [ 10/May/13 ]

We hit this problem in a live system - with a lot of cached items, the number of subdirectories that FileCache creates can exceed the number that an ext3 filesystem allows in a single directory (about 32000).

After that, an attempt to cache a new item can get an error like this:

mkdir() [function.mkdir]: Too many links

Our solution was similar to that suggested:


    protected function getFilename($id) {
        $path = implode(str_split(md5($id), 2), DIRECTORY_SEPARATOR);
        $path = $this->directory . DIRECTORY_SEPARATOR . $path;
        return $path . DIRECTORY_SEPARATOR . $id . $this->extension;
    }

It splits the md5 of the item id into parts of length 2, rather than the original 12. This creates a deeply nested structure, but which won't ever exceed the limit on number of subdirectories in any one directory. It's the same subdirectory pattern used by default by Apache mod_disk_cache, as well.

Comment by Julian Higman [ 05/Jul/13 ]

After a couple of months in production, we ran into another problem with this - we reached the maximum number of inodes in the fielsystem.

The resulting errors look like this:

mkdir() [function.mkdir]: No space left on device

There is actually disk space left, but looking at the inodes shows that the limit has been hit:

-bash-3.2# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 6553600 6553600 0 100% /

The creation of directories and subdirectories can be constrained slightly by using 3 instead of 2 characters (with hex chars, that will give max of 16^3 = 4096 subdirectories per directory, still less than the ext3 limit of 32000)

$path = implode(str_split(md5($id), 2), DIRECTORY_SEPARATOR);

but ultimately the inodes will still all be used up.

The only other options are pruning the cache at intervals, or switching to a different caching strategy altogether.

Comment by Marco Pivetta [ 05/Jul/13 ]

Julian Higman I'd suggest file-based caching mechanisms are not suited for that environment. The file cache is really meant for all those environments where there's strict constraints (like shared hosting).





[DCOM-129] Annotation parser matches colon after annotation Created: 21/Oct/12  Updated: 21/Oct/12

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

Type: Bug Priority: Minor
Reporter: Konstantin Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Code

/**
* Removes given $node from the tree and reparents its descendants
*
* @todo may be improved, to issue single query on reparenting
* @param object $node
* @throws RuntimeException - if something fails in transaction
* @return void
*/
public function removeFromTree($node)
{

fails with `[Semantical Error] The annotation "@todo:" in method Gedmo\Tree\Entity\Repository\ClosureTreeRepository::removeFromTree() was never imported. Did you maybe forget to add a "use" statement for this annotation?`.

As you see it tryes find annotation with name "@todo:". Don't know, maybe rtrim($name, ':') would enough.






[DCOM-229]  DocParser - add support for php5 MyClass::class call to get path of the class Created: 06/Jan/14  Updated: 06/Jan/14

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

Type: Bug Priority: Trivial
Reporter: Umed Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When I try to use in my annotations

 
Career::class

I get Semantical Error. Career is imported, so I dont want to use full class path name again. How about to add this feature to support by annotations?
We need to add some code like this (DocParser#Constant):

 
            if ($found) {
                 if ($const === 'class') {
                    return $className;
                 }

                 $identifier = $className . '::' . $const;
            }
        }

        if (!defined($identifier)) {
            throw AnnotationException::semanticalErrorConstants($identifier, $this->context);
        }

        return constant($identifier);





[DCOM-207] Add AnnotationReader::getFunctionAnnotations() Created: 09/Jul/13  Updated: 09/Jul/13

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

Type: New Feature Priority: Trivial
Reporter: Benjamin Morel Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Currently, the annotation reader supports reading annotations on class, method and property.
This could be extended to read annotations on any kind of function, by adding the following methods:

public function getFunctionAnnotations(\ReflectionFunctionAbstract $function);
public function getFunctionAnnotation(\ReflectionFunctionAbstract $function, $annotationName);

This could be done without breaking BC in the following ways:

  • Keep the Reader interface as it is
  • Add a new interface, for example FullReader, that would extend Reader to add these two methods
  • Add the new methods to AnnotationReader, CachedReader, etc.
  • Update these classes to implement FullReader; thus they would still implement Reader and stay compatible.

Then, on the next major release (3.0.0), we could:

  • Add the two methods to Reader
  • Remove FullReader
  • Add a note to the UPGRADE file to rename FullReader to Reader in application code.

In case you're wondering why I'm proposing this feature, I'm developing a lightweight framework, which allows any method, function, or closure to be used as a controller.
I can currently parse annotations when using a class method, but cannot provide support for annotations on the others.

That would be a great addition.
I've checked the code, and it looks like the only difficulty would be to parse "use" statements for the file where the function is declared, whereas for now it is always assumed that there is a class, and that the file name will be inferred from there. But as ReflectionFunctionAbstract provides a getFileName() method, it's technically feasible as well.

Let me know what you think!
If you have no objection to the concept, I can start working on a PR for this feature.






Generated at Mon Apr 21 09:45:53 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.