Feature #29547

@identity should make property unique in Database

Added by Torsten no-lastname-given almost 4 years ago. Updated over 3 years ago.

Status:Resolved Start date:2012-04-30
Priority:Should have Due date:
Assigned To:Christian Müller % Done:

100%

Category:Persistence
Target version:TYPO3 Flow Base Distribution - 1.1
PHP Version: Complexity:
Has patch:No

Description

A Property with the @indentify annotation is currently not unique in the database.

So you could for example add 2 accounts with the same accountIdentifier. That shouldn't work.


Subtasks

Bug #36717: Remove Identity from ResourceResolvedChristian Müller


Related issues

related to TYPO3.Flow - Feature #30933: Check for unique constraints on add() Needs Feedback 2011-10-14
related to TYPO3.Party - Bug #37266: Duplicate email address throws exception Resolved 2012-05-17
related to TYPO3.Flow - Bug #9557: It's possible to persist multiple entities with the same ... Rejected 2010-09-01
related to TYPO3.Flow - Bug #32823: Make combination of Account identifier and authentication... Resolved 2011-12-23

Associated revisions

Revision b0fb449c
Added by Christian Müller over 3 years ago

[FEATURE] Identity annotation should make properties unique

With this change all properties annotated with the Identity
annotation will be added to an unique constraint in the database.

Change-Id: Ief9455e10c58f999cf46e0586e632ff3e2ef9ad5
Resolves: #29547
Releases: 1.1

Revision a788b292
Added by Karsten Dambekalns over 3 years ago

[TASK] Fix schema migrations adding useless unique indexes

This change removes the index creation commands on the Role table from
the migrations supplied with Ief9455e10c58f999cf46e0586e632ff3e2ef9ad5,
as the involved field is the primary key (and thus a unique index) anyway.

Change-Id: I7280a5f5265109cea8ef110c399c5b76563c4b03
Related: #29547

History

#1 Updated by Karsten Dambekalns almost 4 years ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow

#2 Updated by Karsten Dambekalns almost 4 years ago

  • Category set to Persistence

#3 Updated by Karsten Dambekalns almost 4 years ago

  • Assigned To set to Karsten Dambekalns

#4 Updated by Christian Müller over 3 years ago

  • Status changed from New to Accepted
  • Assigned To changed from Karsten Dambekalns to Christian Müller
  • Has patch set to No

#5 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#6 Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#7 Updated by Gerrit Code Review over 3 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#8 Updated by Adrian Föder over 3 years ago

User Kirab mentioned there were "problems with Resource system"; I assume it's the problem that duplicate \TYPO3\FLOW3\Resource\Resource records may occur, the identities are the following:

 1    /**
 2     * @var \TYPO3\FLOW3\Resource\ResourcePointer
 3     * @ORM\ManyToOne
 4     * @FLOW3\Identity
 5     */
 6    protected $resourcePointer;
 7
 8    /**
 9     * @var string
10     * @FLOW3\Validate(type="StringLength", options={ "maximum"=100 })
11     * @FLOW3\Identity
12     */
13    protected $filename = '';
14
15    /**
16     * @var string
17     * @FLOW3\Validate(type="StringLength", options={ "maximum"=100 })
18     * @FLOW3\Identity
19     */
20    protected $fileExtension = '';

If you upload the exact same file with the same filename, a violation will occur because the same key emerges.
(the ResourcePointer, on the other hand, is intended to be there only once for the same file (content => SHA1).

I would even say the same goes for a Resource: if a Resource has the same filename, extension and ResourcePointer, it is the exact same file and no need for an additional recordset...

If not, or if there should me multiple recordsets for a same file (e.g. for separating ownership etc), the identity must then be a UUID, like usual. I can't see anything more that intrinsically makes a file representation unique than the name, the content and the extension...

#9 Updated by Gerrit Code Review over 3 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#10 Updated by Gerrit Code Review over 3 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#11 Updated by Gerrit Code Review over 3 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#12 Updated by Karsten Dambekalns over 3 years ago

  • Target version set to 1.1

The full stack of changes can be found at https://review.typo3.org/#/q/topic:29547-unique-identity,n,z

#13 Updated by Gerrit Code Review over 3 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#14 Updated by Gerrit Code Review over 3 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#15 Updated by Gerrit Code Review over 3 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#16 Updated by Gerrit Code Review over 3 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#17 Updated by Gerrit Code Review over 3 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#18 Updated by Gerrit Code Review over 3 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#19 Updated by Gerrit Code Review over 3 years ago

Patch set 13 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#20 Updated by Gerrit Code Review over 3 years ago

Patch set 14 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#21 Updated by Gerrit Code Review over 3 years ago

Patch set 15 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#22 Updated by Gerrit Code Review over 3 years ago

Patch set 16 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/9647

#23 Updated by Christian Müller over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF