forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doctrine#5728 Add test for insertable to AbstractMappingDriverTest.
- Loading branch information
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Upsertable.Insertable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Doctrine\ORM\Mapping\ClassMetadataInfo; | ||
|
||
$metadata->setPrimaryTable( | ||
['name' => 'insertable_column'] | ||
); | ||
|
||
$metadata->mapField( | ||
[ | ||
'id' => true, | ||
'fieldName' => 'id', | ||
] | ||
); | ||
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); | ||
|
||
$metadata->mapField( | ||
[ | ||
'fieldName' => 'nonInsertableContent', | ||
'notInsertable' => true, | ||
'options' => ['default' => '1234'], | ||
] | ||
); | ||
$metadata->mapField( | ||
['fieldName' => 'insertableContent'] | ||
); |
16 changes: 16 additions & 0 deletions
16
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Upsertable.Insertable.dcm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="Doctrine\Tests\Models\Upsertable\Insertable" table="insertable_column"> | ||
<id name="id"> | ||
<generator strategy="AUTO"/> | ||
</id> | ||
|
||
<field name="nonInsertableContent" insertable="false" type="string" /> | ||
<field name="insertableContent" insertable="true" type="string" /> | ||
</entity> | ||
</doctrine-mapping> |
16 changes: 16 additions & 0 deletions
16
tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Upsertable.Insertable.dcm.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Doctrine\Tests\Models\Upsertable\Insertable: | ||
type: entity | ||
table: insertable_column | ||
id: | ||
id: | ||
generator: | ||
strategy: AUTO | ||
fields: | ||
nonInsertableContent: | ||
type: string | ||
insertable: false | ||
options: | ||
default: 1234 | ||
insertableContent: | ||
type: string | ||
insertable: true |