Finally I solved my problem.
1. the first thing it to add the namespace of a entity to bootstrap, in my
situation, the namespace is *Gush\Sync\Entity*. I add this directly in the
doctrine.php which locates in vender/bin directory.
2. Secondly, rename the schema file to *Gush.Sync.Entity.Path.dcm.yml. t*his
is important, or it would show " Class 'Path' does not exist". even though
, I did this step. it still shows this error:
Invalid mapping file 'Gush.Sync.Entity.Path.dcm.yml' for class
'Gush\Sync\Entity\Path'
I check doctrine source code , I found the code below in FileDriver.php
$result =
$this->loadMappingFile($this->locator->findMappingFile($className));
//$result is array containing a path key , not sh\Sync\Entity\Path.
$pos= strrpos($className,'\\');
if( $pos)
{
$className=substr($className,$pos+1);
}
if (!isset($result[$className])) { // $className is
Gush\Sync\Entity\Path
throw MappingException::invalidMappingFile($className,
str_replace('\\', '.', $className) . $this->locator->getFileExtension());
}
return $result[$className];
On Monday, August 11, 2014 11:59:26 AM UTC+8, [email protected] wrote:
>
>
> I follow the tutorial Getting Started with Doctrine¶
> <http://doctrine-orm.readthedocs.org/en/latest/tutorials/getting-started.html>,
>
> it defines this directory structure:
>
> |-- config
> | |-- xml
> | `-- yaml
> `-- src
>
>
> it also loads the src directory using composer autoload command:
> {
> "require": {
> "doctrine/orm": "2.4.*",
> "symfony/yaml": "2.*"
> },
> "autoload": {
> *"psr-0": {"": "src/"}*
> }
> }
>
> I tried to create Path entity in my custom directory, for example:
> |-- config
> | |-- xml
> | `-- yaml
> Path.dcm.yml
> |-- modules
> |--Sync
> |--Entity
> Path.php
>
>
> I modify the line *"psr-0": {"": "src/"} *to *"psr-0": {"*
> *Gush\\Sync\\Entity**": "**/modules/Sync/Entity'**"} *and run composer
> update.
>
> I execute "php vendor/bin/doctrine orm:schema-tool:create " , it shows
> this error:
>
>
> [Doctrine\Common\Persistence\Mapping\MappingException]
> Class 'Path' does not exist
>
> Anyone met the same problem before? Please give me some clues. thanks in
> advance.
>
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.