8000 Improve compatibility with DBAL 4 for MySQL, MariaDB and PostgreSQL by morozov · Pull Request #9737 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve compatibility with DBAL 4 for MySQL, MariaDB and PostgreSQL #9737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
[
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255,
'length' => isset($discrColumn['length']) ? (int) $discrColumn['length'] : 255,
'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null,
]
);
Expand Down Expand Up @@ -383,7 +383,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
}

if (isset($idElement['length'])) {
$mapping['length'] = (string) $idElement['length'];
$mapping['length'] = (int) $idElement['length'];
}

if (isset($idElement['column'])) {
Expand Down
6 changes: 4 additions & 2 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,11 @@ private function gatherRelationJoinColumns(

$columnOptions += $this->gatherColumnOptions($fieldMapping);

if ($fieldMapping['type'] === 'string' && isset($fieldMapping['length'])) {
if (isset($fieldMapping['length'])) {
$columnOptions['length'] = $fieldMapping['length'];
} elseif ($fieldMapping['type'] === 'decimal') {
}

if ($fieldMapping['type'] === 'decimal') {
$columnOptions['scale'] = $fieldMapping['scale'];
$columnOptions['precision'] = $fieldMapping['precision'];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsComment.php
10000
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CmsComment

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $text;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Cache/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Action
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
* @GeneratedValue(strategy="NONE")
*/
public $name;
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Cache/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Token
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $token;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Company/CompanyAuction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CompanyAuction extends CompanyEvent
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $data;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Company/CompanyContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @Entity
* @Table(name="company_contracts")
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @EntityListeners({"CompanyContractListener"})
* @DiscriminatorMap({
* "fix" = "CompanyFixContract",
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Company/CompanyEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @Entity
* @Table(name="company_events")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="event_type", type="string")
* @DiscriminatorColumn(name="event_type", type="string", length=255)
* @DiscriminatorMap({"auction"="CompanyAuction", "raffle"="CompanyRaffle"})
*/
abstract class CompanyEvent
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Company/CompanyPerson.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @Entity
* @Table(name="company_persons")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({
* "person" = "CompanyPerson",
* "manager" = "CompanyManager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class JoinedChildClass extends JoinedRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $extension = 'ext';

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
private $additionalId = 'additional';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class JoinedDerivedChildClass extends JoinedDerivedRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $extension = 'ext';

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
private $additionalId = 'additional';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class JoinedDerivedIdentityClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $id = 'part-0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @Entity
* @Table(name = "joined_derived_root")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({"child" = "JoinedDerivedChildClass", "root" = "JoinedDerivedRootClass"})
*/
class JoinedDerivedRootClass
Expand All @@ -34,7 +34,7 @@ class JoinedDerivedRootClass

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $keyPart2 = 'part-2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class JoinedRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $keyPart1 = 'part-1';

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $keyPart2 = 'part-2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class SingleChildClass extends SingleRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $extension = 'ext';

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
private $additionalId = 'additional';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
/**
* @Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({"child" = "SingleChildClass", "root" = "SingleRootClass"})
*/
class SingleRootClass
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $keyPart1 = 'part-1';

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
* @Id
*/
protected $keyPart2 = 'part-2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CustomIdObjectTypeChild
{
/**
* @Id
* @Column(type="CustomIdObject")
* @Column(type="CustomIdObject", length=255)
* @var CustomIdObject
*/
public $id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CustomIdObjectTypeParent
{
/**
* @Id
* @Column(type="CustomIdObject")
* @Column(type="CustomIdObject", length=255)
* @var CustomIdObject
*/
public $id;
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CustomTypeChild

/**
* @var string
* @Column(type="upper_case_string")
* @Column(type="upper_case_string", length=255)
*/
public $lowerCaseString = 'foo';
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class CustomTypeUpperCase

/**
* @var string
* @Column(type="upper_case_string")
* @Column(type="upper_case_string", length=255)
*/
public $lowerCaseString;

/**
* @var string
* @Column(type="upper_case_string", name="named_lower_case_string", nullable = true)
* @Column(type="upper_case_string", length=255, name="named_lower_case_string", nullable = true)
*/
public $namedLowerCaseString;
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DDC117Editor

/**
* @var string|null
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $name;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DDC117Reference

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $description;

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/Models/DDC117/DDC117Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class DDC117Translation
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $language;

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $title;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC1590/DDC1590User.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DDC1590User extends DDC1590Entity
{
/**
* @var string
* @Column(type="string", length=255)
* @Column(type="string", length=255, length=255)
*/
protected $name;
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC1872/DDC1872Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DDC1872Bar
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait DDC1872ExampleTrait
/**
* @var string
* @Id
* @Column(type="string")
* @Column(type="string", length=255)
*/
private $id;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC2504/DDC2504RootClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({
* "root" = "DDC2504RootClass",
* "child" = "DDC2504ChildClass"
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC3597/DDC3597Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discriminator", type="string")
* @DiscriminatorColumn(name="discriminator", type="string", length=255)
* @DiscriminatorMap({ "image" = "DDC3597Image"})
* @HasLifecycleCallbacks
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DDC3699Child extends DDC3699Parent

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $childField;

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC3699/DDC3699Parent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class DDC3699Parent
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
public $parentField;
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC3899/DDC3899Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @Entity
* @Table(name="dc3899_contracts")
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorColumn(name="discr", type="string", length=255)
* @DiscriminatorMap({
* "fix" = "DDC3899FixContract",
* "flexible" = "DDC3899FlexContract"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DDC753EntityWithCustomRepository

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
protected $name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DDC753EntityWithDefaultCustomRepository

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
protected $name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DDC753EntityWithInvalidRepository

/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
protected $name;
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DDC869ChequePayment extends DDC869Payment
{
/**
* @var string
* @Column(type="string")
* @Column(type="string", length=255)
*/
#[ORM\Column(type: 'string')]
protected $serialNumber;
Expand Down
Loading
0