diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UnsignedIntegerItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UnsignedIntegerItem.php new file mode 100644 index 0000000..5127ae5 --- /dev/null +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UnsignedIntegerItem.php @@ -0,0 +1,60 @@ +setLabel(t('Unsigned integer value')); + } + return static::$propertyDefinitions; + } + /** + * {@inheritdoc} + */ + public static function schema(FieldDefinitionInterface $field_definition) { + return array( + 'columns' => array( + 'value' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + ), + ), + ); + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/UnsignedInteger.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/UnsignedInteger.php new file mode 100644 index 0000000..667e1fb --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/UnsignedInteger.php @@ -0,0 +1,26 @@ +setLabel(t('Feed ID')) ->setDescription(t('The ID of the aggregator feed.')) ->setReadOnly(TRUE); @@ -251,7 +251,7 @@ public static function baseFieldDefinitions($entity_type) { ->setLabel(t('URL')) ->setDescription(t('The URL to the feed.')); - $fields['refresh'] = FieldDefinition::create('integer') + $fields['refresh'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Refresh')) ->setDescription(t('How often to check for new feed items, in seconds.')); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php index e48e45d9..22b327c 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php @@ -61,7 +61,7 @@ public function postCreate(EntityStorageControllerInterface $storage_controller) * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['iid'] = FieldDefinition::create('integer') + $fields['iid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Aggregator item ID')) ->setDescription(t('The ID of the feed item.')) ->setReadOnly(TRUE); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php index 4c900da..6d5db7d 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php @@ -167,7 +167,7 @@ public function delete() { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['id'] = FieldDefinition::create('integer') + $fields['id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Custom block ID')) ->setDescription(t('The custom block ID.')) ->setReadOnly(TRUE); @@ -177,7 +177,7 @@ public static function baseFieldDefinitions($entity_type) { ->setDescription(t('The custom block UUID.')) ->setReadOnly(TRUE); - $fields['revision_id'] = FieldDefinition::create('integer') + $fields['revision_id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Revision ID')) ->setDescription(t('The revision ID.')) ->setReadOnly(TRUE); diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php index 3c8b696..5cc315f 100644 --- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php @@ -356,7 +356,7 @@ public function permalink() { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['cid'] = FieldDefinition::create('integer') + $fields['cid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Comment ID')) ->setDescription(t('The comment ID.')) ->setReadOnly(TRUE); diff --git a/core/modules/file/lib/Drupal/file/Entity/File.php b/core/modules/file/lib/Drupal/file/Entity/File.php index 816435b..2979ad3 100644 --- a/core/modules/file/lib/Drupal/file/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Entity/File.php @@ -225,7 +225,7 @@ public static function preDelete(EntityStorageControllerInterface $storage_contr * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['fid'] = FieldDefinition::create('integer') + $fields['fid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('File ID')) ->setDescription(t('The file ID.')) ->setReadOnly(TRUE); @@ -256,7 +256,7 @@ public static function baseFieldDefinitions($entity_type) { ->setLabel(t('File MIME type')) ->setDescription(t("The file's MIME type.")); - $fields['filesize'] = FieldDefinition::create('integer') + $fields['filesize'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('File size')) ->setDescription(t('The size of the file in bytes.')); diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index 90d4fac..f58fe59 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -347,7 +347,7 @@ public function setRevisionAuthorId($uid) { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['nid'] = FieldDefinition::create('integer') + $fields['nid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Node ID')) ->setDescription(t('The node ID.')) ->setReadOnly(TRUE); @@ -357,7 +357,7 @@ public static function baseFieldDefinitions($entity_type) { ->setDescription(t('The node UUID.')) ->setReadOnly(TRUE); - $fields['vid'] = FieldDefinition::create('integer') + $fields['vid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Revision ID')) ->setDescription(t('The node revision ID.')) ->setReadOnly(TRUE); diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Entity/Shortcut.php b/core/modules/shortcut/lib/Drupal/shortcut/Entity/Shortcut.php index 59f8287..762ea0e 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Entity/Shortcut.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Entity/Shortcut.php @@ -134,7 +134,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['id'] = FieldDefinition::create('integer') + $fields['id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('ID')) ->setDescription(t('The ID of the shortcut.')) ->setReadOnly(TRUE); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index f97a44f..7804da8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -236,6 +236,7 @@ function testEntityQuery() { // word but allows us to test revisions and string operations. $ids = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'merhaba') + ->sort('id') ->execute(); $entities = entity_load_multiple('entity_test_mulrev', $ids); foreach ($entities as $entity) { @@ -268,12 +269,14 @@ function testEntityQuery() { $this->assertIdentical($results, $assert); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'siema', 'STARTS_WITH') + ->sort('revision_id') ->execute(); // Now we only get the ones that originally were siema, entity id 8 and // above. $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'a', 'ENDS_WITH') + ->sort('revision_id') ->execute(); // It is very important that we do not get the ones which only have // xsiemax despite originally they were merhaba, ie. ended with a. diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php index 9798c4f..8686cfd 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php @@ -124,7 +124,7 @@ public function label() { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['id'] = FieldDefinition::create('integer') + $fields['id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('ID')) ->setDescription(t('The ID of the test entity.')) ->setReadOnly(TRUE); diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php index e0dce68..3886440 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php @@ -50,7 +50,7 @@ class EntityTestMulRev extends EntityTestRev { public static function baseFieldDefinitions($entity_type) { $fields = parent::baseFieldDefinitions($entity_type); - $fields['revision_id'] = FieldDefinition::create('integer') + $fields['revision_id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Revision ID')) ->setDescription(t('The version id of the test entity.')) ->setReadOnly(TRUE); diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php index a31dcdc..84f7471 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php @@ -69,7 +69,7 @@ public function getRevisionId() { public static function baseFieldDefinitions($entity_type) { $fields = parent::baseFieldDefinitions($entity_type); - $fields['revision_id'] = FieldDefinition::create('integer') + $fields['revision_id'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Revision ID')) ->setDescription(t('The version id of the test entity.')) ->setReadOnly(TRUE); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php index bf85ab8..3d274cc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -200,7 +200,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['tid'] = FieldDefinition::create('integer') + $fields['tid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('Term ID')) ->setDescription(t('The term ID.')) ->setReadOnly(TRUE); diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php index 2954df5..c29b53d 100644 --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -423,7 +423,7 @@ public function setUsername($username) { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $fields['uid'] = FieldDefinition::create('integer') + $fields['uid'] = FieldDefinition::create('unsigned_integer') ->setLabel(t('User ID')) ->setDescription(t('The user ID.')) ->setReadOnly(TRUE);