DDC-1784: Error on generate entities: 'Attribute "allocationSize" of @ORM\SequenceGenerator' #2247

Closed
opened 2026-01-22 13:46:02 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 18, 2012).

Jira issue originally created by user augustoximenes:

When I generated my entities on version 2.2.2 through "orm:convert-mapping", the sequence has a value ' allocationSize="1", initialValue="1" ' with quotes.

So I received an error:

Attribute "allocationSize" of @ORM\SequenceGenerator declared on property entities\Test::$id expects a(n) integer, but got string.

To fix, I removed the quotes. is It a bug?

Part of entity generated:

/****
 * @var integer $id
 *
 * @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="SEQUENCE")
 ** @ORM\SequenceGenerator(sequenceName="test_id_seq", allocationSize="1", initialValue="1") /* SEE QUOTES ON allocationSize="1", initialValue="1" **/
 */
private $id;
Originally created by @doctrinebot on GitHub (Apr 18, 2012). Jira issue originally created by user augustoximenes: When I generated my entities on version 2.2.2 through "orm:convert-mapping", the sequence has a value ' allocationSize="1", initialValue="1" ' with quotes. So I received an error: Attribute "allocationSize" of @ORM\SequenceGenerator declared on property entities\Test::$id expects a(n) integer, but got string. To fix, I removed the quotes. is It a bug? Part of entity generated: ``` /**** * @var integer $id * * @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false) * @ORM\Id * @ORM\GeneratedValue(strategy="SEQUENCE") ** @ORM\SequenceGenerator(sequenceName="test_id_seq", allocationSize="1", initialValue="1") /* SEE QUOTES ON allocationSize="1", initialValue="1" **/ */ private $id; ```
admin added the Bug label 2026-01-22 13:46:02 +01:00
admin closed this issue 2026-01-22 13:46:04 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 18, 2012):

Comment created by augustoximenes:

I think the problem is on the line 1037 to 1042 of Class Doctrine \ ORM \ Tools \ EntityGenerator:

                if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) {
                    $sequenceGenerator[] = 'allocationSize="' . $metadata->sequenceGeneratorDefinition['allocationSize'] . '"';
                }

                if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) {
                    $sequenceGenerator[] = 'initialValue="' . $metadata->sequenceGeneratorDefinition['initialValue'] . '"';
                }

Replace to:

                if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) {
                    $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize'];
                }

                if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) {
                    $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue'];
                }
@doctrinebot commented on GitHub (Apr 18, 2012): Comment created by augustoximenes: I think the problem is on the line 1037 to 1042 of Class Doctrine \ ORM \ Tools \ EntityGenerator: ``` if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { $sequenceGenerator[] = 'allocationSize="' . $metadata->sequenceGeneratorDefinition['allocationSize'] . '"'; } if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { $sequenceGenerator[] = 'initialValue="' . $metadata->sequenceGeneratorDefinition['initialValue'] . '"'; } ``` Replace to: ``` if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; } if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; } ```
Author
Owner

@doctrinebot commented on GitHub (Apr 20, 2012):

Comment created by @FabioBatSilva:

Fixed by : d5d47222c1

@doctrinebot commented on GitHub (Apr 20, 2012): Comment created by @FabioBatSilva: Fixed by : https://github.com/doctrine/doctrine2/commit/d5d47222c1dc5ea97ebd8f4c68834fbe4abeb238
Author
Owner

@doctrinebot commented on GitHub (Apr 20, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Apr 20, 2012): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (May 27, 2012):

Comment created by @beberlei:

Merged into 2.2

@doctrinebot commented on GitHub (May 27, 2012): Comment created by @beberlei: Merged into 2.2
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2247