Basenotes
Well-known member
Hello, I've been following Kier's tutorial and have got to the part on reactions. I am able to react to an item, however it does't show on page reload (though it is stored in the database)
When I click to see who has reacted, I get this error (I'm using Basenotes\Reviews:Review instead of Demo\Pad:Note):
LogicException: Unknown relation or alias Basenotes\Reviews:Review accessed on xf_bn_reviews in src/XF/Mvc/Entity/Finder.php at line 790
Bit's of code I think might be relevant:
src/addons/Basenotes/Reviews/Reaction/Review.php
	
	
	
		
src/addons/Basenotes/Reviews/Entity/Review.php (snippet)
	
	
	
		
src/addons/Basenotes/Reviews/Pub/Controller/Review.php (snippet)
	
	
	
		
admin.php?content-types/


Apologies if this is all obvious stuff, although I've been coding php for about 20 years, it's always been procedural as I've never got my head round OOP sadly
				
			When I click to see who has reacted, I get this error (I'm using Basenotes\Reviews:Review instead of Demo\Pad:Note):
LogicException: Unknown relation or alias Basenotes\Reviews:Review accessed on xf_bn_reviews in src/XF/Mvc/Entity/Finder.php at line 790
- XF\Mvc\Entity\Finder->join() in src/XF/Mvc/Entity/Finder.php at line 672
- XF\Mvc\Entity\Finder->with() in src/XF/Mvc/Entity/Manager.php at line 223
- XF\Mvc\Entity\Manager->findByIds() in src/XF/App.php at line 3240
- XF\App->findByContentType() in src/XF/Reaction/AbstractHandler.php at line 372
- XF\Reaction\AbstractHandler->getContent() in src/XF/Repository/ReactionRepository.php at line 369
- XF\Repository\ReactionRepository->addContentToReactions() insrc/XF/ControllerPlugin/ReactionPlugin.php at line 201
- XF\ControllerPlugin\ReactionPlugin->actionReactions() insrc/addons/Basenotes/Reviews/Pub/Controller/Review.php at line 202
- Basenotes\Reviews\Pub\Controller\Review->actionReactions() in src/XF/Mvc/Dispatcher.php at line362
- XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
- XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
- XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
- XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2826
- XF\App->run() in src/XF.php at line 806
- XF::runApp() in index.php at line 23
Bit's of code I think might be relevant:
src/addons/Basenotes/Reviews/Reaction/Review.php
		PHP:
	
	<?php
namespace Basenotes\Reviews\Reaction;
use XF\Mvc\Entity\Entity;
use XF\Reaction\AbstractHandler;
/**
 */
class Review extends AbstractHandler
{
    public function reactionsCounted(Entity $entity)
    {
        return ($entity->message_state == 'visible');
    }
    public function getEntityWith()
    {
        return ['Basenotes\Reviews:Review', 'Basenotes\Reviews:Review.User'];
    }
}src/addons/Basenotes/Reviews/Entity/Review.php (snippet)
		Code:
	
	   use ReactionTrait;
    public function canReact(&$error = null)
    {
return true;
    }src/addons/Basenotes/Reviews/Pub/Controller/Review.php (snippet)
		PHP:
	
	public function actionReact(ParameterBag $params)
{
    $review = $this->assertViewableReview($params->review_id);
 $reactionPlugin = $this->plugin('XF:Reaction');
  return $reactionPlugin->actionReactSimple($review, 'reviews');
}
public function actionReactions(ParameterBag $params){
        $review = $this->assertViewableReview($params->review_id);
    $reactionPlugin = $this->plugin('XF:Reaction');
        return $reactionPlugin->actionReactions($review, 'reviews/reactions', null, []);
}
protected function assertViewableReview($id, $with=null, $phraseKey=null)
{
  $review = $this->assertReviewExists($id, $with, $phraseKey);
  if (!$review->canView($error))
  {
throw $this->exception(
    $this->noPermission($error)
);
  }
    return $review;
}admin.php?content-types/


Apologies if this is all obvious stuff, although I've been coding php for about 20 years, it's always been procedural as I've never got my head round OOP sadly
 
 
		 
 
		





 
 
		