(fix) Firehose all entities saving properly
This iteration of the firehose does a bunch of things.
It properly saves videos, images and blogs to both elasticsearch and cassandra.
Finally got the mappings working properly. moderated entities will update elasticsearch with moderator_guid and @moderated
We need to insert the object:blog, object:video and object:image fields in their respective types in elasticsearch (calls are in postman)
I have also updated the elasticsearch_provisioner to add those fields for development
changed milestone to %sprint: Hipster Hedgehog
unmarked as a Work In Progress
changed title from WIP: Firehose images video saving properly to Firehose all entities saving properly
changed the description
assigned to @brianhatchet
changed title from Firehose all entities saving properly to (fix) Firehose all entities saving properly
145 145 */ 146 146 public function update(Blog $blog) 147 147 { 148 $shouldReindex = $blog->isDirty('deleted'); 148 $shouldReindex = $blog->isDirty('deleted') || $blog->isDirty('moderatorGuid'); - Developer
This is safe to be rollbacked as it was.
shouldReindex
refers to indexing onto the oldentities_by_time
Cassandra table.
160 * @return int moderator guid 161 */ 162 public function getModeratorGuid() { 163 return $this->moderator_guid; 164 } 165 166 public function setModeratorGuid(int $moderatorGuid) { 167 $this->moderator_guid = $moderatorGuid; 168 return $this; 169 } 170 171 public function getTimeModerated() { 172 return $this->time_moderated; 173 } 174 public function setTimeModerated(int $time) { 175 $this->time_moderated = $time; - Developer
Don't forget returning
$this
.
53 67 } 54 68 55 69 return $response->filter(function ($entity) { 56 return $entity->get('moderator_guid') === null; 70 return empty($entity->getModeratorGuid()); - Developer
Not sure about using
empty()
here. PHP interprets''
and'0'
as falsy values.
68 80 */ 69 81 public function save( 70 82 $entity, 71 83 User $moderator, 72 int $reasonCode = null, 73 int $subreasonCode = null, 74 84 int $time = null) 75 85 { 76 86 if (!$time) { 77 87 $time = time(); 78 88 } 79 89 90 //Save the entity 91 $this->saveEntity($entity, $moderator, $time); 92 93 if ($entity->getType() == 'activity' && $entity->get('entity_guid')) { - Developer
Let's use strict comparison (
===
). Also, we need to be 100% sure that$entity
has agetType()
method. Maybe comparing withinstanceof Activity
?
33 33 'license' => [ 'type' => 'text', '$exportGetter' => 'getLicense' ], 34 34 'rating' => [ 'type' => 'integer', '$exportField' => 'rating' ], 35 35 'nsfw' => [ 'type' => 'array', '$exportGetter' => 'getNsfw' ], 36 'moderator_guid' => [ 'type' => 'text'], - Developer
Spacing before the
]
.