Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feature #31486 [Doctrine][PropertyInfo] Detect if the ID is writeable…
… (dunglas) This PR was merged into the 4.3 branch. Discussion ---------- [Doctrine][PropertyInfo] Detect if the ID is writeable | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a Companion of #31481. Allows to detect that ids with a generated value aren't writable (because the DBMS will generate the ID by itself). It could be considered as a bug fix or as a new feature. I prefer to not merge in in 3.4. However, it becomes necessary for autovalidation to work with such entities, so it should be in 4.3: ```php /** * @entity */ class Foo { /** * @id * @GeneratedValue(strategy="AUTO") * @column(type="integer") */ public $id; } ``` Commits ------- 4598235 [Doctrine][PropertyInfo] Detect if the ID is writeable
- Loading branch information
Showing
3 changed files
with
87 additions
and
13 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
37 changes: 37 additions & 0 deletions
37
src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineGeneratedValue.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,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures; | ||
|
||
use Doctrine\ORM\Mapping\Column; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\GeneratedValue; | ||
use Doctrine\ORM\Mapping\Id; | ||
|
||
/** | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* @Entity | ||
*/ | ||
class DoctrineGeneratedValue | ||
{ | ||
/** | ||
* @Id | ||
* @GeneratedValue(strategy="AUTO") | ||
* @Column(type="integer") | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @Column | ||
*/ | ||
public $foo; | ||
} |