Extract record view details from analytics/views api call
The details of recording a view are hidden away inside the api call.
These details should be in a class (or set of classes) within the code base and be subject to testing with the API left to do it's job of parameter parsing and error handling.
The motivation for this refactor is the ongoing boost improvements. A critical piece of boost functionality that marks a boost as expired has been hidden away inside this seemingly unrelated API call.
Closes #1077
Testing Steps:
- Scroll down newsfeed
- Make a note of the view counters
- Wait an indeterminate amount of time (Counters are stored on the entity within ES?)
- Refresh page
- The view counters should have increased by 1
- added scoped labels 
- changed the description 
- added 1 commit 
- added 1 commit 
- DeveloperMore regression... 2019/12/04 15:36:51 [error] 9#9: *65 FastCGI sent in stderr: "PHP message: Exception #1575473811: TypeError: Return value of Minds\Core\Analytics\Views\Record::recordEntity() must be of the type bool, none returned in /var/www/Minds/engine/Core/Analytics/Views/Record.php:144 Stack trace: #0 /var/www/Minds/engine/Controllers/api/v2/analytics/views.php(37): Minds\Core\Analytics\Views\Record->recordEntity() #1 /var/www/Minds/engine/Api/Factory.php(87): Minds\Controllers\api\v2\analytics\views->post(Array) #2 /var/www/Minds/engine/Controllers/api/api.php(81): Minds\Api\Factory::build(Array, Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response\JsonResponse)) #3 /var/www/Minds/engine/Core/Router.php(157): Minds\Controllers\api\api->post(Array) #4 /var/www/Minds/engine/index.php(9): Minds\Core\Router->route() #5 {main}" while reading response header from upstream, client: 192.168.13.110, server: _, request: "POST /api/v2/analytics/views/activity/1041704347395690512 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "extract-view-api-1077.minds.io", referrer: "https://extract-view-api-1077.minds.io/newsfeed/subscriptions"
- DeveloperAlso... 2019/12/04 15:37:08 [error] 9#9: *65 FastCGI sent in stderr: "PHP message: Attribute rejectReason is not defined in Minds\Core\Boost\Network\Boost (setRejectReason)" while reading response header from upstream, client: 192.168.13.110, server: _, request: "POST /api/v2/analytics/views/boost/1018217353512488976 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "extract-view-api-1077.minds.io", referrer: "https://extract-view-api-1077.minds.io/newsfeed/subscriptions"
- DeveloperObjects of type Minds\Core\Boost\Network\Boostare what is read but the functions we pass that object to are actually expecting an object of typeMinds\Entities\Boost\Network
- DeveloperThis is a lift and shift of original functionality. We have two objects declared for the same thing??? I'm confused now. 
- DeveloperMinds\Entities\Boost\Networkhas asetRejectionReasonmethod. Somebody made a typo withsetRejectReasonand this has never been caught????
- DeveloperShould be setRejectedReason. Was being set byBoost\Network\Repositoryso never worked since that file was created.
- added 1 commit 
- unmarked as a Work In Progress 
- DeveloperNeeds testing instructions. How can I verify this? 
 
- assigned to @gthouret 
- changed the description 
- changed the description 
- changed the description 
- 1 - <?php - 2 - 3 - namespace Minds\Core\Analytics\Views; - 4 - 5 - use Minds\Core; - 6 - use Minds\Core\Di\Di; - 7 - use Minds\Entities; - 8 - use Minds\Helpers\Counters; - 9 - 10 - class Record - Ownerneed phpdocs 
 
- 129 - error_log($e->getMessage()); - 130 - } - 131 - } - 132 - 133 - try { - 134 - $this->manager->record( - 135 - (new Core\Analytics\Views\View()) - 136 - ->setEntityUrn($entity->getUrn()) - 137 - ->setOwnerGuid((string) $entity->getOwnerGuid()) - 138 - ->setClientMeta($this->clientMeta) - 139 - ); - 140 - } catch (\Exception $e) { - 141 - error_log($e); - 142 - } - 143 - 144 - Di::_()->get('Referrals\Cookie') - OwnerThis should be injected in constructor or moved back to controller. 
 
- added scoped label and automatically removed label 
 
  
  
  
 