Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
node system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Jul 2013 at 10:22 UTC
Updated:
29 Jul 2014 at 22:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
claudiu.cristeaSure we want this? Because getting all article nids was (so) straight.
$nids = db_query("SELECT nid FROM {node} WHERE type = :type", array(':type' => 'article'))->fetchCol():(Comment #2
tstoecklerIn the new world order, that's what Entity
FieldQuery is for:Something like
should do the trick. In D8 you will almost never write a direct query anyway, unless you're writing a storage backend.
Edit: Apparently, EFQ -> EQ
Comment #3
claudiu.cristeaThis means that
typewill go out from{node}(plus{node_field_data},{node_field_revision}) and will be stored, as body, in his own table?More:
Comment #4
amateescu commentedI hope what Xano meant was to use the entity reference field that came with the new Entity API (
Drupal\Core\Entity\Plugin\DataType\EntityReferenceItem) not the configurable field provided by the Entity reference module (Drupal\field\Plugin\Type\FieldType\ConfigEntityReferenceItemBase), which means that it will still be stored in the base tables of the node entity.Comment #5
xanoYes, that's what I meant. I'm sorry for the confusion. It's easy to mix those two things up.
Comment #6
claudiu.cristeaOk, ok, that sounds good. I was tempted to take this task but I got no other similar example in core and, as I'm not 100% familiar with this, I don't know exactly were to start :)
Comment #7
xanoA similar situation would be the node uid field, which is also an entity reference. Thing is if you make a patch now, it will most certainly break, because #1757452: Support config entities in entity reference fields isn't in yet. You can, however, start working on it, so we have a non-test usage of the patch in that issue.
Comment #8
claudiu.cristeaI think this is what we want here... or I'm missing something.
With this patch, the node type entity can be reached in this way:
Comment #9
amateescu commentedYep, that's exactly what we need :) This probably needs to be extended to all content entity types, and I would prefer to do it in a single issue/patch since it's such a small change.
Comment #10
claudiu.cristeaFrom IRC:
It seems to me a read-only property but let's debate this. Opinions?
Comment #12
claudiu.cristeaUnfortunately it breaks Condition tests. What I found is that validate fails in
\Drupal\Core\Plugin\ContextAwarePluginBase::setContextValue(). It seems that, somewhere, the validation still tries to check$node->type[0]['target_id']for node type value. It should check$node->type.EDIT: And this seems something changed by the fact that
typeis nowentity_reference_field.Comment #13
claudiu.cristeaThink somebody else has to take this.
Comment #14
klausiComment #15
klausiThis has been committed already in #2112239: Convert base field and property definitions, yay!
Comment #16
xjm