Replacing "Entities" with "Entity"

This commit is contained in:
Jonathan H. Wage 2010-09-01 13:23:46 -05:00 committed by Fabien Potencier
parent c8935cc25a
commit 2914c44344
5 changed files with 14 additions and 14 deletions

View File

@ -73,7 +73,7 @@ EOT
$type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml';
if ($type === 'annotation') {
$destPath .= '/Entities';
$destPath .= '/Entity';
} else {
$destPath .= '/Resources/config/doctrine/metadata';
}
@ -98,7 +98,7 @@ EOT
$output->writeln(sprintf('Converting Doctrine 1 schema "<info>%s</info>"', $input->getArgument('d1-schema')));
foreach ($metadata as $class) {
$className = $class->name;
$class->name = $namespace.'\\'.$bundleClass.'\\Entities\\'.$className;
$class->name = $namespace.'\\'.$bundleClass.'\\Entity\\'.$className;
if ($type === 'annotation') {
$path = $destPath.'/'.$className.'.php';
} else {

View File

@ -55,7 +55,7 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
$filterBundle = $input->getOption('bundle') ? str_replace('/', '\\', $input->getOption('bundle')) : false;
$filterEntity = $filterBundle ? $filterBundle . '\\Entities\\' . str_replace('/', '\\', $input->getOption('entity')) : false;
$filterEntity = $filterBundle ? $filterBundle . '\\Entity\\' . str_replace('/', '\\', $input->getOption('entity')) : false;
if (!isset($filterBundle) && isset($filterEntity)) {
throw new \InvalidArgumentException(sprintf('Unable to specify an entity without also specifying a bundle.'));

View File

@ -42,7 +42,7 @@ The <info>doctrine:generate:entity</info> task initializes a new Doctrine entity
<info>./symfony doctrine:generate:entity "Bundle\MyCustomBundle" "User\Group"</info>
The above would initialize a new entity in the following entity namespace <info>Bundle\MyCustomBundle\Entities\User\Group</info>.
The above would initialize a new entity in the following entity namespace <info>Bundle\MyCustomBundle\Entity\User\Group</info>.
You can also optionally specify the fields you want to generate in the new entity:
@ -71,7 +71,7 @@ EOT
}
$entity = $input->getArgument('entity');
$entityNamespace = $namespace.'\\'.$bundle.'\\Entities';
$entityNamespace = $namespace.'\\'.$bundle.'\\Entity';
$fullEntityClassName = $entityNamespace.'\\'.$entity;
$tmp = str_replace('\\', '/', $fullEntityClassName);
$tmp = str_replace('/', '\\', dirname($tmp));
@ -108,7 +108,7 @@ EOT
$exporter = $cme->getExporter($mappingType);
if ($mappingType === 'annotation') {
$path = $dirs[$namespace].'/'.$bundle.'/Entities/'.str_replace($entityNamespace.'\\', null, $fullEntityClassName).'.php';
$path = $dirs[$namespace].'/'.$bundle.'/Entity/'.str_replace($entityNamespace.'\\', null, $fullEntityClassName).'.php';
$exporter->setEntityGenerator($this->getEntityGenerator());
} else {

View File

@ -71,7 +71,7 @@ EOT
$type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml';
if ($type === 'annotation') {
$destPath .= '/Entities';
$destPath .= '/Entity';
} else {
$destPath .= '/Resources/config/doctrine/metadata';
}
@ -99,7 +99,7 @@ EOT
$output->writeln(sprintf('Importing mapping information from "<info>%s</info>" entity manager', $emName));
foreach ($metadata as $class) {
$className = $class->name;
$class->name = $namespace.'\\'.$bundleClass.'\\Entities\\'.$className;
$class->name = $namespace.'\\'.$bundleClass.'\\Entity\\'.$className;
if ($type === 'annotation') {
$path = $destPath.'/'.$className.'.php';
} else {

View File

@ -89,7 +89,7 @@ path for the **GuestbookBundle** we created above:
Any files found in here that have a suffix of **.dcm.xml** (or whatever
mapping_driver you picked) are used as your entities mapping information.
In the **GuestbookBundle** we have a file named **Bundle.GuestbookBundle.Entities.Entry.dcm.xml**
In the **GuestbookBundle** we have a file named **Bundle.GuestbookBundle.Entity.Entry.dcm.xml**
which contains the following XML:
<?xml version="1.0" encoding="UTF-8"?>
@ -99,7 +99,7 @@ which contains the following XML:
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Bundle\GuestbookBundle\Entities\Entry" table="guestbook_entry">
<entity name="Bundle\GuestbookBundle\Entity\Entry" table="guestbook_entry">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
@ -121,13 +121,13 @@ mapping information with the command:
$ php console doctrine:generate:entities
Now if you have a look in the bundles **Entities** directory you will see a new
Now if you have a look in the bundles **Entity** directory you will see a new
file named **Entry.php** with some code like the following:
[php]
// Bundle/GuestbookBundle/Entities/Entry.php
// Bundle/GuestbookBundle/Entity/Entry.php
namespace Bundle\GuestbookBundle\Entities;
namespace Bundle\GuestbookBundle\Entity;
/**
* @Entity
@ -214,7 +214,7 @@ You can easily generate a new Doctrine entity for a bundle by using the
$ php console doctrine:generate:entity "Bundle\MySampleBundle" "User\Group" --fields="name:string(255) description:text"
Now if you have a look inside the bundle you will see that you have a **Group** class
located here **Bundle/MySampleBundle/Entities/User/Group.php**.
located here **Bundle/MySampleBundle/Entity/User/Group.php**.
Now you can customize the mapping information for the entity by editing the metadata
information inside **Bundle/MySampleBundle/Resources/config/doctrine/metadata** and