Add the bio of the persons in the paragraph field

This commit is contained in:
David Valdez 2019-10-02 21:02:54 -05:00
parent 964f541a08
commit e7f8b292c9
3 changed files with 58 additions and 1 deletions

View file

@ -27,10 +27,18 @@ class Author extends SqlBase {
// The bio value is going to be get from the last contribution of the user
// where the bio field is not empty.
$query = $this->database->query(
'SELECT entity_id, revision_id FROM field_data_field_author WHERE field_author_value = :field_author ORDER BY entity_id DESC',
'SELECT
fdfa.entity_id,
fdfa.revision_id,
n.nid
FROM field_data_field_author fdfa
LEFT JOIN node n ON (n.nid = fdfa.entity_id)
WHERE field_author_value = :field_author
ORDER BY entity_id DESC',
['field_author' => $field_author]
);
foreach ($query as $record) {
$row->setSourceProperty('uid', $record->uid);
$bio_query = $this->database->query(
"SELECT field_author_bio_value FROM field_data_field_author_bio WHERE entity_id = :entity_id AND revision_id = :revision_id",
['entity_id' => $record->entity_id, 'revision_id' => $record->revision_id]