[DDC-1285] Select by multiple ids Created: 22/Jul/11 Updated: 11/Jan/13 |
|
| Status: | In Progress |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Serge Smertin | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
How do you look at adding findByIds(array $ids) to EntityManager and UnitOfWork? This would allow fetching multiple entities from a database at one request and would be very useful for caching - there would be even some kind of IdentityMap kept in memcached or any other caching engine, that supports multiple id retrieval: i've been using such an architecture in multiple projects and it turned out to be very effective. There were two basic methods - findIdsByFilter(array $filter) and findEntitiesByIds(array $ids). The latter one had a caching proxy, replicating entities to a cache storage. If this idea proceeds - I'd be glad to cover it with more details. This topic on StackOverflow could also help: |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-1178] Have access to "original" metadata in events subscribed to loadClassMetadata Created: 27/May/11 Updated: 27/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.x |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Miha Vrhovnik | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If you subscribe to loadClassMetadata you will usually modify the metadata for some classes. My proposal would be to add function get(Original|Raw)MappingData into interface Doctrine\ORM\Mapping\Driver\Driver which would either return raw data or data in a object specific for that Driver or null if it doesn't make sense for that driver. Please note, that when loading from e.g XmlDriver we should return simplexmlnode or dom node as loadClassMetadata should be in its own namespace and not pollute the Doctrine one. |
| Comments |
| Comment by Gediminas Morkevicius [ 27/May/11 ] |
|
Sounds logic, each driver would expect NULL or data (wrapped specifically for the driver used) |
[DDC-1025] Please repalce 'Doctrine\XXX\YYY' with '\Doctrine\XXX\YYY' in code and document Created: 09/Feb/11 Updated: 13/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, DQL, Mapping Drivers, ORM, Tools |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | ben yan | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | None | ||
| Description |
|
It will help us use the namespace and code autocomplete in some IDE. |
| Comments |
| Comment by Matthieu Napoli [ 08/Apr/11 ] |
|
Hi, do you have any more information about this ? I'm confused because the php documentation uses the Doctrine\XXX way, and everywhere I've seen, it is used like that. Thanks |
| Comment by Karsten Dambekalns [ 11/Apr/11 ] |
|
The issue is simple and logical. When an IDE (I am using PhpStorm and it does it like this) sees a namespace in a file, upon seeing namespaces afterwards, it sees them as absolute if they have a leading backslash, or relative when it does not. This affects the resolution of classes for type navigation, code inspection, ... The same rules as for actual PHP code should be used within comments. Here is an example: namespace Foo;
class Bar {
/**
* @var Baz
*/
protected $baz;
/**
* @var \Quux
*/
protected $quux;
}
The IDE will think $baz is \Foo\Baz and $quux will be seen as being \Quux. Now if you have some reference to Doctrine here, and it was relative, the IDE would assume it's \Foo\Doctrine\... |
| Comment by Benjamin Eberlei [ 11/Apr/11 ] |
|
Well yes, but since all our code examples have no leading namespace argument this means the code is in the default namespace, making Doctrine\XXX\YY a relative namespace that is actually valid. |
| Comment by Karsten Dambekalns [ 11/Apr/11 ] |
|
Yes, but the source code docblocks are what is meant here as far as I am concerned. |
| Comment by Andrey Kolyshkin [ 13/May/11 ] |
|
Example (Entitymanager.php): namespace Doctrine\ORM; and /** * The used Configuration. * * @var Doctrine\ORM\Configuration */ private $config; Result: Should be: /** * The used Configuration. * * @var Configuration */ private $config; Or /** * The used Configuration. * * @var \Doctrine\ORM\Configuration */ private $config; |
| Comment by Miha Vrhovnik [ 27/May/11 ] |
|
Why don't you take this to the PhpStorm tracker as it surely is a bug in IDE? |
| Comment by Karsten Dambekalns [ 27/May/11 ] |
|
Miha, what makes you think it's an IDE bug? In a class in namespace Foo another class named Bar is \Foo\Bar, but \Bar is \Bar. Why is it a bug if the IDE follows the namespace resolution rules? |
| Comment by Michael Ridgway [ 11/Jul/11 ] |
|
The issue is that PHPStorm and NetBeans have different class resolution rules. I also use PHPStorm and most of Doctrine does not resolve auto-completion correctly because of this issue. I'd be willing to work on this if it would be accepted. |
| Comment by Andrew Mackrodt [ 29/Sep/11 ] |
|
I've been evaluating PhpStorm and also came across this issue; I believe the problem is due to Doctrine rather than being a bug with the IDE although it would be nice if PhpStorm would assume namespaces are absolute if they're not resolved upon an initial lookup. I created a quick c# app to append the beginning forward slash to any @var or @return attributes within Doctrine's source. It's working for me with Doctrine 2.1.2 and PhpStorm (IntelliJ): http://pastebin.com/4HxiWvJA - hopefully this will be of use for anyone else using these IDEs;. Note: the application doesn't detect multiple line annotations although the only one I'm aware of is the getAST method in Doctrine\ORM\Query.php. |
| Comment by Benjamin Eberlei [ 13/Dec/11 ] |
|
This issue is referenced in Github Pull-Request GH-215 |
| Comment by Benjamin Eberlei [ 13/Dec/11 ] |
|
This issue is referenced in Github Pull-Request GH-216 |
[DDC-972] MySql MyISAM support Created: 07/Jan/11 Updated: 13/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | nicolas isnardi | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
All |
||
| Description |
|
We can not set MySql Engine for MyISAM. MySqlPlatform has a _getCreateTableSQL where you can pass some options with the engine param. |
| Comments |
| Comment by Cédric Tailly [ 19/May/11 ] |
|
I have the same problem and I didn't found documentation to select the engine for a given table. I tried to understand the code by myself and made modifications of my Doctrine v2.0.5, perhaps this is not the best one but here is a beginning of a solution : ------------------------------------------------------------------------------- @ ORM\Mapping\Driver\DoctrineAnnotations.php:100 final class Table extends Annotation { public $name; public $schema; public $indexes; public $uniqueConstraints; public $engine; }@ ORM\Mapping\Driver\AnnotationDriver.php:144 $primaryTable = array( @ ORM\Tools\SchemaTool.php:133 $table = $schema->createTable($class->getQuotedTableName($this->_platform)); if ( isset($class->table["engine"]) ) ------------------------------------------------------------------------------- ...and to define for instance the MyISAM engine in annotations : /**
Because there is no foreign key on MyISAM tables, there are still problems on the schema creation/update when Doctrine executes the corresponding "alter table" SQL commands. |
| Comment by gabriel sancho [ 12/Jul/12 ] |
|
in Doctrine 2.2.2 will be Doctrine/ORM/Tools/SchemaTool.php-149- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1719- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1723- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Table.php-42- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-181- /// PATCH ------------------------------------ i found a problem in ManyToMany relations, the intermediate table will be InnoDB |
| Comment by Benjamin Eberlei [ 13/Jul/12 ] |
|
You can do all tables as MyISAM already through metadata using @Table(options= {"engine": "MyISAM"}) except Many-To-Many Join Tables. But you could create a listener to the "postSchemaGenerate" event and accept the schema instance there, modify everything accordingly. |
| Comment by Christophe Coevoet [ 13/Jul/12 ] |
|
should we add the support of the options for the @JoinTable annotation ? |
| Comment by Benjamin Eberlei [ 13/Jul/12 ] |
|
Yes, that is probably what this ticket boils down to |
[DDC-930] A table cannot have more than one many to many relationship with the same table when using reverse engineer Created: 13/Dec/10 Updated: 13/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0-RC2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Jiri Helmich | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
FreeBSD, PostgreSQL 8.4 |
||
| Description |
|
This is caused by taking the join column name as the identifier while generating a property name for annotation. The mapping driver detects that the same property is already defined and ends the convert process. A little bit smarter approach for me was to take the local table name. But this assumes a specific style of join table naming convention. Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass() Replace: $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower(current($otherFk->getColumns())))); With: $name = explode("_",$myFk->getLocalTableName()); $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower($name))); Maybe to switch to this behavior with an additional option? |
[DDC-1308] Add cache for transient information and invalidation for ClassMetadata Created: 31/Jul/11 Updated: 20/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Two different things have to be improved in the caching: 1. The information isTransient() has to be moved to the ClassMetadataFactory and cached there. |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-1957] DB -> Entity: Reverse engeniering with two relations between two tables Created: 29/Jul/12 Updated: 29/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | sky diablo | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Cli | ||
| Environment: |
windows 7, php 5.3, symfony 2.1 |
||
| Description |
|
i use the cli from the symfony 2.1 project to reverse from DB to Entity: php app/console doctrine:mapping:convert xml ./src/Acme/StoreBundle/Resources/config/doctrine/metadata/orm --from-database --force and i get tis error: [Doctrine\ORM\Mapping\MappingException] so i have a table "radUser" with two m:n relations to the same table "radAttributes": Table radUser: so doctrine reverse mapping try to generate the radAttribute entity with two mapping to radUser with the same field name "radUser", what can i do to prevent this issue ? |
[DDC-1645] Paths to Annotations classes are not considered Created: 10/Feb/12 Updated: 10/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, Mapping Drivers |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | feathers and down | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
openSUSE 12.1 x86, Apache/2.2.21, mysql 5.5.16, PHP 5.3.8 (modules: Core, ctype, curl, date, dom, ereg, filter, gd, hash, http, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, pcre, PDO, pdo_mysql, pdo_sqlite, Reflection, session, SimpleXML, SPL, SQLite, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib ) |
||
| Attachments: |
|
| Description |
|
Hi, my battle is described here: http://groups.google.com/group/doctrine-user/browse_thread/thread/db9c77b6bc000f13 When I follow bugtracker tutorial I think that there is an error when working with Annotations, see these examples: Start a new bugtracker project as described in tutorial from scratch, create folders and files as tutorial expose, then do following changes: 1) put Product, Bug, User class files at root level, same level as bootstraps files and create_xxxxx files 1) YAML so Setup method path argument is considered correctly, Doctrine engine must know where yaml files for classes are. 2) XML so Setup method path argument is considered correctly again, Doctrine engine must know where xml files for classes are. 3) Annotations so Setup method path argument IS NOT CONSIDERED, Doctrine engine use already defined classes to get Annotations docblocks using php reflexion classes, methods and functions. How to deal with this? I mean... a) Erase path argument from Setup::createAnnotationMetadataConfiguration methos (and similar functions for Annotations) because is not needed, classes and annotations must be defined before. I know that is easy to follow tutorial guidelines to develop applications in Annotations point of view, load them before Doctrine script start (with require/include or autoloaders, etc) and will work, but I think that is wrong how tutorial and functional logic are given, so a) and b) are my proposed solutions. I think b) should be right, get dockblocks from a class already defined and if are not defined it follow XML and YAML logic: read metadata from other files. Attachment: My bugtracker Netbeans project. Sorry by my english |
[DDC-1817] Allowing to specify MySQL Collation on Field Basis Created: 08/May/12 Updated: 08/May/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, Tools |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Johannes Schmitt | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It would be nice to be able to specify which collation to use on a field basis. This would for example be useful when you have case-sensitive (utf8_bin), and case-insensitive (utf8_general_ci) values. Right now, this needs to be manually added to migration files (which is ok for projects, but it is not so nice for distributable libraries). |
[DDC-1738] Allow multiple Generators per class Created: 29/Mar/12 Updated: 20/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Guilherme Blanco | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should be able to support multiple generators per class. Currently we only support 1 generator per class. |
[DDC-138] Allow for mixed inheritance mapping Created: 12/Nov/09 Updated: 24/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Reinier Kip | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Requesting implementation of mixed inheritance mapping (class table inheritance and single table inheritance). This would be especially handy when the difference between certain classes is only "implementational" (i.e. a subclass only functions differently/implements abstract methods and does not specify any additional fields). Using class table inheritance would result in tables only containing an id column. |
[DDC-1180] Indexed Associations: foreign key (association) cannot be used as indexBy field Created: 29/May/11 Updated: 02/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Petr Sobotka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
Using Doctrine ORM 2.1.0BETA1 |
||
| Description |
|
I am trying to index a collection by its entity's column which is also a foreign key (association). It seems to me that it is not possible at the moment. For example: /**
* @Entity
*/
class Hotel
{
// $id column and other stuff
/**
* @oneToMany(targetEntity="Booking", mappedBy="hotel", indexBy="room")
* @var Booking[]
*/
private $bookings;
}
/**
* @Entity
*/
class Booking
{
/**
* @var Hotel
*
* @Id
* @ManyToOne(targetEntity="Hotel", inversedBy="bookings")
* @JoinColumns({
* @JoinColumn(name="hotel_id", referencedColumnName="id")
* })
*/
private $hotel;
/**
* @var Room
*
* @Id
* @ManyToOne(targetEntity="Room")
* @JoinColumns({
* @JoinColumn(name="room_id", referencedColumnName="id")
* })
*/
private $room;
}
Only possible workaround I found is to define another (plain) entity's property mapped to the same table column and index by it: /**
* @Entity
*/
class Hotel
{
// $id column and other stuff
/**
* @oneToMany(targetEntity="Booking", mappedBy="hotel", indexBy="roomId")
* @var Booking[]
*/
private $bookings;
}
/**
* @Entity
*/
class Booking
{
// ...
/**
* @var Room
*
* @Id
* @ManyToOne(targetEntity="Room")
* @JoinColumns({
* @JoinColumn(name="room_id", referencedColumnName="id")
* })
*/
private $room;
/**
* @var integer $roomId
*
* @Column(name="room_id", type="integer", nullable=false)
*/
private $roomId;
}
Wouldn't it be easy to support it? |
| Comments |
| Comment by Benjamin Eberlei [ 05/Jun/11 ] |
|
It is not so easy to implement from the first gimplse and it is not a bug but an improvement/feature request. |
| Comment by Benjamin Morel [ 02/Mar/13 ] |
|
Related PR: https://github.com/doctrine/doctrine2/pull/204 |
[DDC-2337] Allow an entity to use its own persister to take advantage of DB level features if necessary Created: 06/Mar/13 Updated: 06/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Nathanael Noblet | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I have a situation where I wanted a single table to use INSERT DELAYED. Its an audit log table where I expect each http request to generate many inserts for. In an effort to not over tax the system I implemented a custom Entity Persister so that it would work. This obviously doesn't work with all mapping drivers. However if this is a feature that you think is worth integrating I will fork it on github and complete the implementation alongside any changes/improvements requested... |
[DDC-2147] Custom annotation in MappedSuperclass Created: 15/Nov/12 Updated: 07/May/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | kluk | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 3.6.6-1.fc17.x86_64 |
||
| Attachments: |
|
| Description |
|
When you try use custom annotation in mappedsuperclass like here http://pastebin.com/YMxKvcLk and then i try get metadata for class i get this error |
| Comments |
| Comment by kluk [ 15/Nov/12 ] |
|
error log from orm:validate-schema |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Copying from pastebin: use \Doctrine\ORM\Mapping as ORM; use \xxx\Doctrine\Annotation\Entity as re; use \xxx\Doctrine\Annotation\Forms as rf; use \Doctrine\Common\Collections; /** * @ORM\Entity */ class EventPicture extends \Picture { /** * @ORM\ManyToOne(targetEntity="Event", inversedBy="eventPicture") * @ORM\JoinColumn(name="FK_Event", referencedColumnName="id") */ protected $event; } use \Doctrine\ORM\Mapping as ORM; use \xxx\Doctrine\Annotation\Entity as re; use \xxx\Doctrine\Annotation\Forms as rf; use \Doctrine\Common\Collections; /** @ORM\MappedSuperclass */ class Picture extends \xxx\Doctrine\Entity\BaseEntity { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="IDENTITY") * @var type */ protected $id; /** * @ORM\Column(type="string",unique=true, nullable=false) * @rf\FileUpload(fileSize="php",uploadType="local",fieldName="link",formControl="FileUploadField",image=true) * */ protected $link; } kluk does this happen also with any other simple custom annotation? For example following:
/**
* @Annotation
* @Target({"PROPERTY","ANNOTATION"})
*/
final class Entity implements Annotation
{
/**
* @var string
*/
public $value;
}
|
| Comment by kluk [ 30/Jan/13 ] |
|
the same error when using simple annotation.
<?php
use \Doctrine\ORM\Mapping as ORM;
use \xxx\Doctrine\Annotation\Entity as re;
use \xxx\Doctrine\Annotation\Forms as rf;
use \Doctrine\Common\Collections;
/** @ORM\MappedSuperclass */
class Picture extends \xxx\Doctrine\Entity\BaseEntity {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
* @var type
*/
protected $id;
/**
* @ORM\Column(type="integer")
* @rf\SetClass({"class","hide"})
*/
public $value;
/**
* @ORM\Column(type="string",unique=true, nullable=true)
* @rf\FileUpload(fileSize="php",uploadType="local",fieldName="link",formControl="FileUploadField",image=true)
*
*/
protected $link;
}
When i remove $value , $picture from class everything goes ok.
/**
* INTERNAL:
* Adds a field mapping without completing/validating it.
* This is mainly used to add inherited field mappings to derived classes.
*
* @param array $fieldMapping
*
* @return void
*/
public function addInheritedFieldMapping(array $fieldMapping)
{
if(isset($fieldMapping['fieldName'])){
$this->fieldMappings[$fieldMapping['fieldName']] = $fieldMapping;
$this->columnNames[$fieldMapping['fieldName']] = $fieldMapping['columnName'];
$this->fieldNames[$fieldMapping['columnName']] = $fieldMapping['fieldName'];
}
}
But i dont know if this fix can break another part of doctrine. |
| Comment by Benjamin Eberlei [ 04/May/13 ] |
|
Can you put the code of your annotations online? I can't seem to understand why this happens. |
| Comment by kluk [ 07/May/13 ] |
|
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml namespace libs\Doctrine\Annotation\Entity; use Doctrine\Common\Annotations\Annotation; /** @Annotation */ class CustomMapping extends Annotation { /** * * @var string */ public $className; /** * * * @var IQueryable| string */ public $dataSource; } |
[DDC-2387] convert-mapping not working correctly with composite primary keys/foreign keys in 2.4.0-RC1 Created: 03/Apr/13 Updated: 11/Jun/13 |
|
| Status: | Reopened |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 2.3.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Nicholas Van Dusen | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Symfony 2.2.0, MySQL 5.1 |
||
| Description |
|
(Apologies if this is somehow a Symfony-specific issue) I updated my application via Composer yesterday, and received Doctrine 2.4.0-RC1. After this update, generating entities has been problematic under certain circumstances. Here is an example table in MySQL: CREATE TABLE `user_email` ( `user_id` int(10) unsigned NOT NULL COMMENT 'FK to user', `email` varchar(254) NOT NULL, `email_datasource` smallint(1) unsigned NOT NULL COMMENT 'FK to datasource_code', `insert_date` datetime NOT NULL, PRIMARY KEY (`user_id`,`email`,`email_datasource`), KEY `FK_UserEmail_DataSourceCode` (`email_datasource`), CONSTRAINT `FK_UserEmail_User` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 In Doctrine 2.3, the mapping works correctly, and you end up with a 3-part primary key, with a user property mapped to the User entity, and a datasourceCode property mapped to the DatasourceCode entity. All good. In 2.4, the following error is given: Single id is not allowed on composite primary key in entity UserEmail. Removing one of the foreign keys in the table (either to User or DatasourceCode) but keeping the primary key set to all 3 columns allows the mapping to work. But, if you then remove one of the columns from the primary key (say, email_datasource) it fails again. |
| Comments |
| Comment by Benjamin Eberlei [ 04/Apr/13 ] |
|
Can you provide the full stack trace to the exception please? $e->getTraceAsString(); |
| Comment by Nicholas Van Dusen [ 11/Apr/13 ] |
|
Benjamin, I'm not sure how to get the trace for you, since I'm running from inside the Symfony2 doctrine:mapping:import command line item. |
| Comment by Christophe Coevoet [ 11/Apr/13 ] |
|
Use the --verbose option when running the command |
| Comment by Nicholas Van Dusen [ 11/Apr/13 ] |
|
I was able to get a trace for you: #0 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1571): Doctrine\ORM\Mapping\MappingException::singleIdNotAllowedOnCompositePrimaryKey('UserEmail') #1 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(422): Doctrine\ORM\Mapping\ClassMetadataInfo->getSingleIdentifierFieldName() #2 /var/www/html/voxrepublic/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(136): Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping(Object(Doctrine\ORM\Mapping\ClassMetadata)) #3 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(302): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array) #4 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(212): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('UserEmail') #5 /var/www/html/voxrepublic/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(112): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('UserEmail') #6 /var/www/html/voxrepublic/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php(108): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() #7 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php(240): Doctrine\Bundle\DoctrineBundle\Command\ImportMappingDoctrineCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(78): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /var/www/html/voxrepublic/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(106): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /var/www/html/voxrepublic/app/console(22): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput)) #12 {main} |
| Comment by Benjamin Eberlei [ 14/Apr/13 ] |
|
The problem is that Doctrine seems to detect that you only have on id field on this entity and then a new function of 2.4 throws this error. I will try to reproduce this with your table. Until then could you show me the var_dump() of the $class variable in Doctrine\ORM\ClassMetadataFactory#completeIdGeneratorMapping()? This would help very much already. |
| Comment by Maximilian Beck [ 15/Apr/13 ] |
|
I have the same error when using "doctrine:mapping:import" CREATE TABLE IF NOT EXISTS `dev_Recipe`.`step` (
`recipe_id` INT NOT NULL ,
`step_number` INT NOT NULL ,
`description` TEXT NULL ,
`timer` INT NULL ,
`image` VARCHAR(100) NULL ,
PRIMARY KEY (`recipe_id`, `step_number`) ,
INDEX `recipe_id_idx` (`recipe_id` ASC) ,
INDEX `step_number` (`step_number` ASC) ,
CONSTRAINT `step_recipe_id`
FOREIGN KEY (`recipe_id` )
REFERENCES `dev_Recipe`.`recipe` (`recipe_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
Exception trace: () at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\MappingException.php:258 Doctrine\ORM\Mapping\MappingException::singleIdNotAllowedOnCompositePrimaryKey() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php:1571 Doctrine\ORM\Mapping\ClassMetadataInfo->getSingleIdentifierFieldName() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:422 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:136 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:302 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:212 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:112 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand.php:126 Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand->execute() at \htdocs\SF2\vendor\doctrine\doctrine-bundle\Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand.php:59 Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand->execute() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:240 Symfony\Component\Console\Command\Command->run() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:193 Symfony\Component\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:78 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:106 Symfony\Component\Console\Application->run() at \htdocs\SF2\app\console:22 "var_dump($class);" returns: object(Doctrine\ORM\Mapping\ClassMetadata)#470 (36) {
["name"]=>
string(10) "Ingredient"
["namespace"]=>
string(0) ""
["rootEntityName"]=>
string(10) "Ingredient"
["customGeneratorDefinition"]=>
NULL
["customRepositoryClassName"]=>
NULL
["isMappedSuperclass"]=>
bool(false)
["parentClasses"]=>
array(0) {
}
["subClasses"]=>
array(0) {
}
["namedQueries"]=>
array(0) {
}
["namedNativeQueries"]=>
array(0) {
}
["sqlResultSetMappings"]=>
array(0) {
}
["identifier"]=>
array(1) {
[0]=>
string(12) "ingredientId"
}
["inheritanceType"]=>
int(1)
["generatorType"]=>
int(1)
["fieldMappings"]=>
array(4) {
["ingredientId"]=>
array(6) {
["id"]=>
bool(true)
["fieldName"]=>
string(12) "ingredientId"
["columnName"]=>
string(13) "ingredient_id"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["name"]=>
array(6) {
["fieldName"]=>
string(4) "name"
["columnName"]=>
string(4) "name"
["type"]=>
string(6) "string"
["length"]=>
int(45)
["fixed"]=>
bool(false)
["nullable"]=>
bool(false)
}
["color"]=>
array(5) {
["fieldName"]=>
string(5) "color"
["columnName"]=>
string(5) "color"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["img"]=>
array(6) {
["fieldName"]=>
string(3) "img"
["columnName"]=>
string(3) "img"
["type"]=>
string(6) "string"
["length"]=>
int(45)
["fixed"]=>
bool(false)
["nullable"]=>
bool(true)
}
}
["fieldNames"]=>
array(4) {
["ingredient_id"]=>
string(12) "ingredientId"
["name"]=>
string(4) "name"
["color"]=>
string(5) "color"
["img"]=>
string(3) "img"
}
["columnNames"]=>
array(4) {
["ingredientId"]=>
string(13) "ingredient_id"
["name"]=>
string(4) "name"
["color"]=>
string(5) "color"
["img"]=>
string(3) "img"
}
["discriminatorValue"]=>
NULL
["discriminatorMap"]=>
array(0) {
}
["discriminatorColumn"]=>
NULL
["table"]=>
array(1) {
["name"]=>
string(10) "ingredient"
}
["lifecycleCallbacks"]=>
array(0) {
}
["associationMappings"]=>
array(1) {
["ingredientCategory"]=>
array(15) {
["fieldName"]=>
string(18) "ingredientCategory"
["targetEntity"]=>
string(18) "IngredientCategory"
["mappedBy"]=>
string(10) "ingredient"
["type"]=>
int(8)
["inversedBy"]=>
NULL
["isOwningSide"]=>
bool(false)
["sourceEntity"]=>
string(10) "Ingredient"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["orphanRemoval"]=>
bool(false)
}
}
["isIdentifierComposite"]=>
bool(false)
["containsForeignIdentifier"]=>
bool(false)
["idGenerator"]=>
NULL
["sequenceGeneratorDefinition"]=>
NULL
["tableGeneratorDefinition"]=>
NULL
["changeTrackingPolicy"]=>
int(1)
["isVersioned"]=>
NULL
["versionField"]=>
NULL
["reflClass"]=>
NULL
["isReadOnly"]=>
bool(false)
["namingStrategy":protected]=>
object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) {
}
["reflFields"]=>
array(0) {
}
["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=>
NULL
}
object(Doctrine\ORM\Mapping\ClassMetadata)#472 (36) {
["name"]=>
string(18) "IngredientCategory"
["namespace"]=>
string(0) ""
["rootEntityName"]=>
string(18) "IngredientCategory"
["customGeneratorDefinition"]=>
NULL
["customRepositoryClassName"]=>
NULL
["isMappedSuperclass"]=>
bool(false)
["parentClasses"]=>
array(0) {
}
["subClasses"]=>
array(0) {
}
["namedQueries"]=>
array(0) {
}
["namedNativeQueries"]=>
array(0) {
}
["sqlResultSetMappings"]=>
array(0) {
}
["identifier"]=>
array(1) {
[0]=>
string(2) "id"
}
["inheritanceType"]=>
int(1)
["generatorType"]=>
int(1)
["fieldMappings"]=>
array(3) {
["id"]=>
array(6) {
["id"]=>
bool(true)
["fieldName"]=>
string(2) "id"
["columnName"]=>
string(2) "id"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["name"]=>
array(6) {
["fieldName"]=>
string(4) "name"
["columnName"]=>
string(4) "name"
["type"]=>
string(6) "string"
["length"]=>
int(255)
["fixed"]=>
bool(false)
["nullable"]=>
bool(false)
}
["description"]=>
array(4) {
["fieldName"]=>
string(11) "description"
["columnName"]=>
string(11) "description"
["type"]=>
string(4) "text"
["nullable"]=>
bool(true)
}
}
["fieldNames"]=>
array(3) {
["id"]=>
string(2) "id"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["columnNames"]=>
array(3) {
["id"]=>
string(2) "id"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["discriminatorValue"]=>
NULL
["discriminatorMap"]=>
array(0) {
}
["discriminatorColumn"]=>
NULL
["table"]=>
array(1) {
["name"]=>
string(19) "ingredient_category"
}
["lifecycleCallbacks"]=>
array(0) {
}
["associationMappings"]=>
array(2) {
["ingredient"]=>
array(19) {
["fieldName"]=>
string(10) "ingredient"
["targetEntity"]=>
string(10) "Ingredient"
["inversedBy"]=>
string(18) "ingredientCategory"
["joinTable"]=>
array(3) {
["name"]=>
string(30) "ingredient_category_ingredient"
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(22) "ingredient_category_id"
["referencedColumnName"]=>
string(2) "id"
}
}
["inverseJoinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(13) "ingredient_id"
["referencedColumnName"]=>
string(13) "ingredient_id"
}
}
}
["type"]=>
int(8)
["mappedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(18) "IngredientCategory"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["joinTableColumns"]=>
array(2) {
[0]=>
string(22) "ingredient_category_id"
[1]=>
string(13) "ingredient_id"
}
["relationToSourceKeyColumns"]=>
array(1) {
["ingredient_category_id"]=>
string(2) "id"
}
["relationToTargetKeyColumns"]=>
array(1) {
["ingredient_id"]=>
string(13) "ingredient_id"
}
["orphanRemoval"]=>
bool(false)
}
["parent"]=>
array(19) {
["fieldName"]=>
string(6) "parent"
["targetEntity"]=>
string(18) "IngredientCategory"
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(9) "parent_id"
["referencedColumnName"]=>
string(2) "id"
}
}
["type"]=>
int(2)
["mappedBy"]=>
NULL
["inversedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(18) "IngredientCategory"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["sourceToTargetKeyColumns"]=>
array(1) {
["parent_id"]=>
string(2) "id"
}
["joinColumnFieldNames"]=>
array(1) {
["parent_id"]=>
string(9) "parent_id"
}
["targetToSourceKeyColumns"]=>
array(1) {
["id"]=>
string(9) "parent_id"
}
["orphanRemoval"]=>
bool(false)
}
}
["isIdentifierComposite"]=>
bool(false)
["containsForeignIdentifier"]=>
bool(false)
["idGenerator"]=>
NULL
["sequenceGeneratorDefinition"]=>
NULL
["tableGeneratorDefinition"]=>
NULL
["changeTrackingPolicy"]=>
int(1)
["isVersioned"]=>
NULL
["versionField"]=>
NULL
["reflClass"]=>
NULL
["isReadOnly"]=>
bool(false)
["namingStrategy":protected]=>
object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) {
}
["reflFields"]=>
array(0) {
}
["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=>
NULL
}
object(Doctrine\ORM\Mapping\ClassMetadata)#474 (36) {
["name"]=>
string(6) "Recipe"
["namespace"]=>
string(0) ""
["rootEntityName"]=>
string(6) "Recipe"
["customGeneratorDefinition"]=>
NULL
["customRepositoryClassName"]=>
NULL
["isMappedSuperclass"]=>
bool(false)
["parentClasses"]=>
array(0) {
}
["subClasses"]=>
array(0) {
}
["namedQueries"]=>
array(0) {
}
["namedNativeQueries"]=>
array(0) {
}
["sqlResultSetMappings"]=>
array(0) {
}
["identifier"]=>
array(1) {
[0]=>
string(8) "recipeId"
}
["inheritanceType"]=>
int(1)
["generatorType"]=>
int(1)
["fieldMappings"]=>
array(3) {
["recipeId"]=>
array(6) {
["id"]=>
bool(true)
["fieldName"]=>
string(8) "recipeId"
["columnName"]=>
string(9) "recipe_id"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["name"]=>
array(6) {
["fieldName"]=>
string(4) "name"
["columnName"]=>
string(4) "name"
["type"]=>
string(6) "string"
["length"]=>
int(255)
["fixed"]=>
bool(false)
["nullable"]=>
bool(false)
}
["description"]=>
array(4) {
["fieldName"]=>
string(11) "description"
["columnName"]=>
string(11) "description"
["type"]=>
string(4) "text"
["nullable"]=>
bool(true)
}
}
["fieldNames"]=>
array(3) {
["recipe_id"]=>
string(8) "recipeId"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["columnNames"]=>
array(3) {
["recipeId"]=>
string(9) "recipe_id"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["discriminatorValue"]=>
NULL
["discriminatorMap"]=>
array(0) {
}
["discriminatorColumn"]=>
NULL
["table"]=>
array(1) {
["name"]=>
string(6) "recipe"
}
["lifecycleCallbacks"]=>
array(0) {
}
["associationMappings"]=>
array(2) {
["recipeCategory"]=>
array(15) {
["fieldName"]=>
string(14) "recipeCategory"
["targetEntity"]=>
string(14) "RecipeCategory"
["mappedBy"]=>
string(6) "recipe"
["type"]=>
int(8)
["inversedBy"]=>
NULL
["isOwningSide"]=>
bool(false)
["sourceEntity"]=>
string(6) "Recipe"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["orphanRemoval"]=>
bool(false)
}
["users"]=>
array(19) {
["fieldName"]=>
string(5) "users"
["targetEntity"]=>
string(5) "Users"
["inversedBy"]=>
string(12) "recipeRecipe"
["joinTable"]=>
array(3) {
["name"]=>
string(13) "users_recipes"
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(16) "recipe_recipe_id"
["referencedColumnName"]=>
string(9) "recipe_id"
}
}
["inverseJoinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(8) "users_id"
["referencedColumnName"]=>
string(2) "id"
}
}
}
["type"]=>
int(8)
["mappedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(6) "Recipe"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["joinTableColumns"]=>
array(2) {
[0]=>
string(16) "recipe_recipe_id"
[1]=>
string(8) "users_id"
}
["relationToSourceKeyColumns"]=>
array(1) {
["recipe_recipe_id"]=>
string(9) "recipe_id"
}
["relationToTargetKeyColumns"]=>
array(1) {
["users_id"]=>
string(2) "id"
}
["orphanRemoval"]=>
bool(false)
}
}
["isIdentifierComposite"]=>
bool(false)
["containsForeignIdentifier"]=>
bool(false)
["idGenerator"]=>
NULL
["sequenceGeneratorDefinition"]=>
NULL
["tableGeneratorDefinition"]=>
NULL
["changeTrackingPolicy"]=>
int(1)
["isVersioned"]=>
NULL
["versionField"]=>
NULL
["reflClass"]=>
NULL
["isReadOnly"]=>
bool(false)
["namingStrategy":protected]=>
object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) {
}
["reflFields"]=>
array(0) {
}
["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=>
NULL
}
object(Doctrine\ORM\Mapping\ClassMetadata)#476 (36) {
["name"]=>
string(14) "RecipeCategory"
["namespace"]=>
string(0) ""
["rootEntityName"]=>
string(14) "RecipeCategory"
["customGeneratorDefinition"]=>
NULL
["customRepositoryClassName"]=>
NULL
["isMappedSuperclass"]=>
bool(false)
["parentClasses"]=>
array(0) {
}
["subClasses"]=>
array(0) {
}
["namedQueries"]=>
array(0) {
}
["namedNativeQueries"]=>
array(0) {
}
["sqlResultSetMappings"]=>
array(0) {
}
["identifier"]=>
array(1) {
[0]=>
string(2) "id"
}
["inheritanceType"]=>
int(1)
["generatorType"]=>
int(1)
["fieldMappings"]=>
array(3) {
["id"]=>
array(6) {
["id"]=>
bool(true)
["fieldName"]=>
string(2) "id"
["columnName"]=>
string(2) "id"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["name"]=>
array(6) {
["fieldName"]=>
string(4) "name"
["columnName"]=>
string(4) "name"
["type"]=>
string(6) "string"
["length"]=>
int(45)
["fixed"]=>
bool(false)
["nullable"]=>
bool(false)
}
["description"]=>
array(6) {
["fieldName"]=>
string(11) "description"
["columnName"]=>
string(11) "description"
["type"]=>
string(6) "string"
["length"]=>
int(45)
["fixed"]=>
bool(false)
["nullable"]=>
bool(true)
}
}
["fieldNames"]=>
array(3) {
["id"]=>
string(2) "id"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["columnNames"]=>
array(3) {
["id"]=>
string(2) "id"
["name"]=>
string(4) "name"
["description"]=>
string(11) "description"
}
["discriminatorValue"]=>
NULL
["discriminatorMap"]=>
array(0) {
}
["discriminatorColumn"]=>
NULL
["table"]=>
array(1) {
["name"]=>
string(15) "recipe_category"
}
["lifecycleCallbacks"]=>
array(0) {
}
["associationMappings"]=>
array(2) {
["recipe"]=>
array(19) {
["fieldName"]=>
string(6) "recipe"
["targetEntity"]=>
string(6) "Recipe"
["inversedBy"]=>
string(14) "recipeCategory"
["joinTable"]=>
array(3) {
["name"]=>
string(22) "recipe_category_recipe"
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(18) "recipe_category_id"
["referencedColumnName"]=>
string(2) "id"
}
}
["inverseJoinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(9) "recipe_id"
["referencedColumnName"]=>
string(9) "recipe_id"
}
}
}
["type"]=>
int(8)
["mappedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(14) "RecipeCategory"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["joinTableColumns"]=>
array(2) {
[0]=>
string(18) "recipe_category_id"
[1]=>
string(9) "recipe_id"
}
["relationToSourceKeyColumns"]=>
array(1) {
["recipe_category_id"]=>
string(2) "id"
}
["relationToTargetKeyColumns"]=>
array(1) {
["recipe_id"]=>
string(9) "recipe_id"
}
["orphanRemoval"]=>
bool(false)
}
["parent"]=>
array(19) {
["fieldName"]=>
string(6) "parent"
["targetEntity"]=>
string(14) "RecipeCategory"
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(9) "parent_id"
["referencedColumnName"]=>
string(2) "id"
}
}
["type"]=>
int(2)
["mappedBy"]=>
NULL
["inversedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(14) "RecipeCategory"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["sourceToTargetKeyColumns"]=>
array(1) {
["parent_id"]=>
string(2) "id"
}
["joinColumnFieldNames"]=>
array(1) {
["parent_id"]=>
string(9) "parent_id"
}
["targetToSourceKeyColumns"]=>
array(1) {
["id"]=>
string(9) "parent_id"
}
["orphanRemoval"]=>
bool(false)
}
}
["isIdentifierComposite"]=>
bool(false)
["containsForeignIdentifier"]=>
bool(false)
["idGenerator"]=>
NULL
["sequenceGeneratorDefinition"]=>
NULL
["tableGeneratorDefinition"]=>
NULL
["changeTrackingPolicy"]=>
int(1)
["isVersioned"]=>
NULL
["versionField"]=>
NULL
["reflClass"]=>
NULL
["isReadOnly"]=>
bool(false)
["namingStrategy":protected]=>
object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) {
}
["reflFields"]=>
array(0) {
}
["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=>
NULL
}
object(Doctrine\ORM\Mapping\ClassMetadata)#478 (36) {
["name"]=>
string(4) "Step"
["namespace"]=>
string(0) ""
["rootEntityName"]=>
string(4) "Step"
["customGeneratorDefinition"]=>
NULL
["customRepositoryClassName"]=>
NULL
["isMappedSuperclass"]=>
bool(false)
["parentClasses"]=>
array(0) {
}
["subClasses"]=>
array(0) {
}
["namedQueries"]=>
array(0) {
}
["namedNativeQueries"]=>
array(0) {
}
["sqlResultSetMappings"]=>
array(0) {
}
["identifier"]=>
array(2) {
[0]=>
string(10) "stepNumber"
[1]=>
string(6) "recipe"
}
["inheritanceType"]=>
int(1)
["generatorType"]=>
int(1)
["fieldMappings"]=>
array(4) {
["stepNumber"]=>
array(6) {
["id"]=>
bool(true)
["fieldName"]=>
string(10) "stepNumber"
["columnName"]=>
string(11) "step_number"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(false)
}
["description"]=>
array(4) {
["fieldName"]=>
string(11) "description"
["columnName"]=>
string(11) "description"
["type"]=>
string(4) "text"
["nullable"]=>
bool(true)
}
["timer"]=>
array(5) {
["fieldName"]=>
string(5) "timer"
["columnName"]=>
string(5) "timer"
["type"]=>
string(7) "integer"
["unsigned"]=>
bool(false)
["nullable"]=>
bool(true)
}
["image"]=>
array(6) {
["fieldName"]=>
string(5) "image"
["columnName"]=>
string(5) "image"
["type"]=>
string(6) "string"
["length"]=>
int(100)
["fixed"]=>
bool(false)
["nullable"]=>
bool(true)
}
}
["fieldNames"]=>
array(4) {
["step_number"]=>
string(10) "stepNumber"
["description"]=>
string(11) "description"
["timer"]=>
string(5) "timer"
["image"]=>
string(5) "image"
}
["columnNames"]=>
array(4) {
["stepNumber"]=>
string(11) "step_number"
["description"]=>
string(11) "description"
["timer"]=>
string(5) "timer"
["image"]=>
string(5) "image"
}
["discriminatorValue"]=>
NULL
["discriminatorMap"]=>
array(0) {
}
["discriminatorColumn"]=>
NULL
["table"]=>
array(1) {
["name"]=>
string(4) "step"
}
["lifecycleCallbacks"]=>
array(0) {
}
["associationMappings"]=>
array(1) {
["recipe"]=>
array(20) {
["fieldName"]=>
string(6) "recipe"
["targetEntity"]=>
string(6) "Recipe"
["id"]=>
bool(true)
["joinColumns"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(9) "recipe_id"
["referencedColumnName"]=>
string(9) "recipe_id"
}
}
["type"]=>
int(1)
["mappedBy"]=>
NULL
["inversedBy"]=>
NULL
["isOwningSide"]=>
bool(true)
["sourceEntity"]=>
string(4) "Step"
["fetch"]=>
int(2)
["cascade"]=>
array(0) {
}
["isCascadeRemove"]=>
bool(false)
["isCascadePersist"]=>
bool(false)
["isCascadeRefresh"]=>
bool(false)
["isCascadeMerge"]=>
bool(false)
["isCascadeDetach"]=>
bool(false)
["sourceToTargetKeyColumns"]=>
array(1) {
["recipe_id"]=>
string(9) "recipe_id"
}
["joinColumnFieldNames"]=>
array(1) {
["recipe_id"]=>
string(9) "recipe_id"
}
["targetToSourceKeyColumns"]=>
array(1) {
["recipe_id"]=>
string(9) "recipe_id"
}
["orphanRemoval"]=>
bool(false)
}
}
["isIdentifierComposite"]=>
bool(true)
["containsForeignIdentifier"]=>
bool(true)
["idGenerator"]=>
NULL
["sequenceGeneratorDefinition"]=>
NULL
["tableGeneratorDefinition"]=>
NULL
["changeTrackingPolicy"]=>
int(1)
["isVersioned"]=>
NULL
["versionField"]=>
NULL
["reflClass"]=>
NULL
["isReadOnly"]=>
bool(false)
["namingStrategy":protected]=>
object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) {
}
["reflFields"]=>
array(0) {
}
["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=>
NULL
}
|
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
Fixed and merged back to 2.3 |
| Comment by Nicholas Van Dusen [ 29/May/13 ] |
|
I tested this again using 2.3.4 (the version which contains this fix) and it is still occurring. Attempting to import mapping for a table with 2 foreign keys in the primary key results in the error "Database does not have any mapping information." Adding a third column on the primary key "fixes" the issue. Currently our developers are being asked to add a fake third part to the key to work around the issue, then delete that key once they get into the entity class. This is a bit tedious and I'd love to see a fix! |
| Comment by Nicholas Van Dusen [ 29/May/13 ] |
|
Issue still present in 2.3.4 and 2.4.0-RC1 |
| Comment by Guillermo [ 11/Jun/13 ] |
|
The database engine I use is PostgreSQL. I'm having problems when mapping entities with composite primary keys in other tables. CREATE TABLE public.establecimiento ( id_establecimiento integer NOT NULL, establecimiento character varying(100) NOT NULL, CONSTRAINT pk_establecimiento PRIMARY KEY (id_establecimiento ) ) WITH ( OIDS=FALSE ); CREATE TABLE public.establecimiento_sec ( id_establecimiento_sec integer NOT NULL, id_establecimiento integer NOT NULL, det_seccion character varying(40) NOT NULL, plano character varying(100), sector_ingreso character varying(254), sponsor_imagen_sec character varying(96000), CONSTRAINT pk_establecimientos_sec PRIMARY KEY (id_establecimiento_sec , id_establecimiento ), CONSTRAINT fk_establec_reference_establec FOREIGN KEY (id_establecimiento) REFERENCES public.establecimiento (id_establecimiento) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT ) WITH ( OIDS=TRUE ); CREATE TABLE public.establecimiento_sec_plano ( id_establecimiento_sec_plano integer NOT NULL, id_establecimiento_sec integer NOT NULL, id_establecimiento integer NOT NULL, det_plano character varying(512), cantidad integer NOT NULL, precio double precision, insert_charge double precision DEFAULT 0, descr character varying(254), CONSTRAINT pk_establecimiento_sec_plano PRIMARY KEY (id_establecimiento_sec_plano , id_establecimiento_sec , id_establecimiento ), CONSTRAINT fk_establecimiento_sec FOREIGN KEY (id_establecimiento, id_establecimiento_sec) REFERENCES public.establecimiento_sec (id_establecimiento, id_establecimiento_sec) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE ) WITH ( OIDS=FALSE ); Defining the entity establecimientoSecPlano, $establecimientoSec variable containing the keys $establecimiento and $id_establecimiento_sec //Entity/EstablecimientosSecPlano /**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Ticketway\PruebaBundle\Entity\EstablecimientosSec")
* @ORM\JoinColumns(
* @ORM\JoinColumn(name="id_establecimiento_sec", referencedColumnName="id_establecimiento_sec"),
* @ORM\JoinColumn(name="id_establecimiento", referencedColumnName="id_establecimiento"))
*/
private $establecimientoSec;
//Entity/EstablecimientosSec /**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Ticketway\PruebaBundle\Entity\Establecimientos")
* @ORM\JoinColumn(name="id_establecimiento", referencedColumnName="id_establecimiento")
*/
private $establecimiento;
When executing the command doctrine: mapping: import I get the following error [Doctrine\ORM\Mapping\MappingException] |
[DDC-1247] Implement AnnotationDriver::addExcludePath Created: 04/Jul/11 Updated: 19/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Filip Procházka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Hi, For example, I have my descendant of PHPUnit_Framework_TestCase in libs and the driver just dies, because PHPUnit is not loaded, and I don't want to load it, to be able to finish the process. Solution would be add method AnnotationDriver::addExcludePath, whose name speaks for itself Temporarily, I had to extend the AnnotationDriver and overload the crawling process, which is realy annoing, because I had to copy the whole method with all its exceptions and I would have to maintain it, till this will be in Doctrine. Can be viewed here https://github.com/Kdyby/Framework/blob/master/libs/Kdyby/Doctrine/Mapping/Driver/AnnotationDriver.php Thanks |
| Comments |
| Comment by Jan Dolecek [ 20/Apr/12 ] |
|
This behavior really messes with my projects, as it automatically loads all php files. Not just those with classes, but also simple scripts, which can do horrible stuff (e.g. I've got scripts to make changes in the source code!) Annotations should be read without executing the scripts, e.g. by TokenReflection library: https://github.com/Andrewsville/PHP-Token-Reflection |
| Comment by Patrik Votoček [ 27/Aug/12 ] |
| Comment by Christophe Coevoet [ 19/Sep/12 ] |
|
@Jan Tokenizing the file was the way annotations were handled in 2.0. Doctrine 2.1 switched to using Reflection to read annotation because it is faster. @Filip I'm wondering why you would have PHPUnit testcases in a path storing entities. |
| Comment by Filip Procházka [ 19/Sep/12 ] |
|
@stof > Tokenizing the file was the way annotations were handled in 2.0. Doctrine 2.1 switched to using Reflection to read annotation because it is faster. And it is obviousely the wrong one. There is no argument, that could beat the fact, that the result can and should be cached, as it does already. Correct behaviour is much more valuable than few miliseconds on first run. > I'm wondering why you would have PHPUnit testcases in a path storing entities. I don't. They are base classes for the actual tests. I agree they might (or should) be somewhere else, but the fact, that they should not be executed, when readed, stays. |
| Comment by Christophe Coevoet [ 19/Sep/12 ] |
|
@Filip The AnnotationReader is not loading any file. It simply expects a ReflectionClass. The ORM AnnotationDriver expects a path in which it should look for annotated classes, to be able to implement getAllClasses() (as it cannot expect all classes to be already loaded). And btw, the behavior was the same in 2.0 when the reader was using tokenization. |
[DDC-1198] Add PHPDocs to annotationclasses Created: 08/Jun/11 Updated: 08/Jun/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Robert Gruendler | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
If an IDE would like to support annotations, it's currently only possible to display all resolvable classes in a code-hint menu when autocompleting annotations, as To make it possible for IDEs to detect classes which are explicitly meant to be used as annotations, it would be nice to agree on some common Here's an example of what this could look like: https://github.com/pulse00/doctrine2/commit/25a14e9edc406edfd33e54fc38922a191e9cbe83 This way IDEs can prioritize annotated classes in code-hints and add additional information to the user. |
[DDC-1373] Map file with specific class Created: 13/Sep/11 Updated: 14/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Fabio B. Silva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian LAMP - PHP5.3 - Apache 2 |
||
| Description |
|
Hi there, It's a cool feature because it's allow loading on-demand. It should be great to be able to manually map XML/YAML File description to a Class, like : This feature is simple to implement, just add a new array inside AbsractFileDriver to know the mapping. AbsractFileDriver->getAllClassNames () just return value of mapping array. With this new feature, it allow developers to create a pretty folder that contains entities mapping. Armetiz. |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-2053] [GH-460] added support to extend strategies for IdGenerators Created: 02/Oct/12 Updated: 03/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| 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 Powerhamster: Url: https://github.com/doctrine/doctrine2/pull/460 Message: Mapping drivers now use extended classmetadata class to find constants of generator types. |
| Comments |
| Comment by Benjamin Eberlei [ 03/Oct/12 ] |
|
A related Github Pull-Request [GH-460] was closed |
[DDC-2035] XML Mapping : add attribute "length" for tag "id" Created: 20/Sep/12 Updated: 29/Sep/12 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Erik Müller | Assignee: | Fabio B. Silva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux, Doctrine ORM 2.3.0, MySQL |
||
| Description |
|
XML mapping : <id name="id" type="string" length="16"/> Generate SQL : id varchar(255) not null
It's not possible with XML mapping to have : id varchar(16) not null
Because tag "id" doesn't support "length" attribute. |
| Comments |
| Comment by Fabio B. Silva [ 20/Sep/12 ] |
|
Hi Erik, The atribute "id" arealdy support "length" in the current doctrine version Which version are you using ? |
[DDC-2030] better way to detect class parents Created: 13/Sep/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Asmir Mustafic | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi! I'm trying to detect some inheritance cases, but there is a problem. Doctrine always uses PHP class inheritance to detect entity hierarchy, but generating entities starting from database, i have not yet any php class. There is a better way to detect entities hierarchy? Without php classes... The practical case is: Even if i manualy create XML mapping files, and then i try to generate php entityes. There is the same problem. XmlDriver tries to call setDiscriminatorMap method that raises the same exception. |
[DDC-1993] New method required: ClassMetadataInfo::isAssociationNullable() Created: 22/Aug/12 Updated: 22/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | gregoire_m | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, I'm working with Symfony 2.1, and I need to know if an association is nullable for a given entity (to know if a form field should be marked as 'required'). So I'd like to have a isAssociationNullable() method in the ClassMetadataInfo class, that should do the same thing that the isNullable() method does for fields. You can see more information about the problem on the Symfony issue. Thanks. |
[DDC-2308] Naming Strategy for Reverse Engeneering Created: 21/Feb/13 Updated: 21/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Andreas Prucha | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Unfortunately DatabaseDriver::getClassNameForTable() is declared as private method, which makes it quite difficult to change the naming strategy for reverse engeneering. IMO this sould be declared protected. An even better way would be to extend the interface of the Naming Strategy objects to support the reverse direction: classToTableName -> tableToClassName This way we would have a consistent name-mapping |
[DDC-2288] Schema Tool doesn't update collation on table level Created: 08/Feb/13 Updated: 08/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, Tools |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Rickard Andersson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | collation, schematool | ||
| Description |
|
In Symfony2, when updating the collation option of a table, the schema tool doesn't recognize the change: Changing from: * @ORM\Table() To:
* @ORM\Table(options={"collate"="utf8_swedish_ci"})
Results in: $ php app/console doctrine:schema:update --dump-sql Nothing to update - your database is already in sync with the current entity metadata. |
[DDC-957] When there is no GeneratedValue strategy on a primary key, setter function should be generated Created: 29/Dec/10 Updated: 29/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Flyn San | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.3.3 |
||
| Description |
|
In the YAML/XML, if no GeneratedValue strategy is given for the primary key, a setter function is required in the generated entity class. Currently only a getter is made. |
[DDC-2281] Validation against database-first generated xml requires that the column order within a composite primary key match the order the columns are in in mapping xml Created: 06/Feb/13 Updated: 09/May/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Aaron Moore | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In using a database-first approach utilizing orm:convert-mapping to generate xml, the validation and schema-tool reports that my composite primary key (ex. Columns A, C, B) be dropped and added in the order in which the mapping appears in the xml (ex. Columns A, B, C). These columns are not auto-increment and are simply a mixture of int and varchar. |
| Comments |
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
Is the composite key a mix of association and field types? |
| Comment by Aaron Moore [ 09/May/13 ] |
|
I'm trying to remember the usage as it was a short term project but I believe it is. For example a user has a userid. The table in question might have a primary key consisting of the userid and an int representing a year.. |
[DDC-2467] Incorrect work with default values, indexes, autoincrement (patch attached) Created: 23/May/13 Updated: 28/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM, Tools |
| Affects Version/s: | 2.3.4 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | And | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
If you use in your MySQL database default values, indexes or string primary key, you get incorrect mapping by mapping generator. For get it - just use in database one or more from listed abilities, generate mapping for that and then try to dump-sql with schema-tool:update. Hope you fix it. Tnx! |
| Comments |
| Comment by Marco Pivetta [ 23/May/13 ] |
|
Marked as minor improvement - thank you for the patch! |
| Comment by And [ 28/May/13 ] |
|
When it will be merged? Maybe, planned version? |
| Comment by Marco Pivetta [ 28/May/13 ] |
|
And such a patch requires failing tests before being applied - that's up to whoever picks it up. |
| Comment by And [ 28/May/13 ] |
|
So if I add patch with tests - it will be merged? =) |
| Comment by Marco Pivetta [ 28/May/13 ] |
|
Most probably - you can open a pull request against the current ORM master for that |
[DDC-747] Add support for table, column and indexes comments Created: 13/Aug/10 Updated: 14/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | s9e | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Description |
|
It would be nice to add support for table comments, column comments and indexes comments, i.e. @Table(
name="ecommerce_products",
comment="Contains products",
indexes={@index(name="search_idx", comment="Makes finding people by name easier", columns={"name", "email"})}
)
@Column(type="integer", comment="Stores the user's age, in years")
MySQL supports comments via ALTER TABLE since 4.1. For databases that don't support those persistent comments, you could use normal SQL comments in the table definition. Of course they wouldn't be stored by the database, but at least they would appear in the generated schema, that's better than nothing. |
[DDC-1169] Entities outside of drivers' namespaces only give 'is not a valid entity' Created: 25/May/11 Updated: 25/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Jiří Petruželka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, |
[DDC-1614] On OneToOne mappings with Primary Key same as Foreign Key, using @Id in the foreign association does not carry over when running "generate-entities" with --generate-annotations=1 Created: 22/Jan/12 Updated: 23/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM, Tools |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Ryan Fink | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fedora 15, php 5.3.8 |
||
| Description |
|
When having a OneToOne mapping that has a primary key that is the same as the foreign key, using the @Id attribute does not carry over when generating entities. Example code: class User
/**
class User_ExtraAttrs
When running "doctrine orm:generate-entities --regenerate-entities=1 --generate-annotations=1", the @Id in User_ExtraAttrs does not carry over. It must be manually inserted. |