Closed luutruong closed 6 years ago
Error: Call to a member function getAvatarUrl() on null src/addons/Xfrocks/Api/XF/Transform/ConversationMessage.php:166
#0 src/addons/Xfrocks/Api/Transformer.php(315): Xfrocks\Api\XF\Transform\ConversationMessage->collectLinks(Object(Xfrocks\Api\Transform\TransformContext)) #1 src/addons/Xfrocks/Api/Transformer.php(139): Xfrocks\Api\Transformer->transform(Object(Xfrocks\Api\Transform\TransformContext)) #2 src/addons/Xfrocks/Api/XF/Transform/ConversationMaster.php(92): Xfrocks\Api\Transformer->transformEntity(Object(Xfrocks\Api\Transform\TransformContext), 'first_message', Object(XF\Entity\ConversationMessage)) #3 src/addons/Xfrocks/Api/Transformer.php(307): Xfrocks\Api\XF\Transform\ConversationMaster->calculateDynamicValue(Object(Xfrocks\Api\Transform\TransformContext), 'first_message') #4 src/addons/Xfrocks/Api/Transformer.php(139): Xfrocks\Api\Transformer->transform(Object(Xfrocks\Api\Transform\TransformContext)) #5 src/addons/Xfrocks/Api/Transformer.php(168): Xfrocks\Api\Transformer->transformEntity(Object(Xfrocks\Api\Transform\TransformContext), NULL, Object(XF\Entity\ConversationMaster)) #6 src/addons/Xfrocks/Api/XF/Transform/ConversationUser.php(32): Xfrocks\Api\Transformer->transformEntityRelation(Object(Xfrocks\Api\Transform\TransformContext), NULL, Object(XF\Entity\ConversationUser), 'Master') #7 src/addons/Xfrocks/Api/Transformer.php(324): Xfrocks\Api\XF\Transform\ConversationUser->onTransformed(Object(Xfrocks\Api\Transform\TransformContext), Array) #8 src/addons/Xfrocks/Api/Transformer.php(225): Xfrocks\Api\Transformer->transform(Object(Xfrocks\Api\Transform\TransformContext)) #9 src/addons/Xfrocks/Api/Transform/LazyTransformer.php(182): Xfrocks\Api\Transformer->transformFinder(Object(Xfrocks\Api\Transform\TransformContext), NULL, Object(XF\Finder\ConversationUser), Object(Closure)) #10 src/addons/Xfrocks/Api/Transform/LazyTransformer.php(86): Xfrocks\Api\Transform\LazyTransformer->transform() #11 src/XF/Mvc/Renderer/Json.php(235): Xfrocks\Api\Transform\LazyTransformer->jsonSerialize() #12 src/addons/Xfrocks/Api/XF/ApiOnly/Mvc/Renderer/Json.php(96): XF\Mvc\Renderer\Json->prepareJsonEncode(Object(Xfrocks\Api\Transform\LazyTransformer)) #13 src/XF/Mvc/Renderer/Json.php(230): Xfrocks\Api\XF\ApiOnly\Mvc\Renderer\Json->prepareJsonEncode(Object(Xfrocks\Api\Transform\LazyTransformer)) #14 src/addons/Xfrocks/Api/XF/ApiOnly/Mvc/Renderer/Json.php(96): XF\Mvc\Renderer\Json->prepareJsonEncode(Array) #15 src/XF/Mvc/Renderer/Json.php(167): Xfrocks\Api\XF\ApiOnly\Mvc\Renderer\Json->prepareJsonEncode(Array) #16 src/addons/Xfrocks/Api/XF/ApiOnly/Mvc/Renderer/Json.php(17): XF\Mvc\Renderer\Json->postFilter(Array, Object(Xfrocks\Api\Mvc\Reply\Api)) #17 src/XF/Mvc/Dispatcher.php(311): Xfrocks\Api\XF\ApiOnly\Mvc\Renderer\Json->postFilter(Array, Object(Xfrocks\Api\Mvc\Reply\Api)) #18 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(Xfrocks\Api\Mvc\Reply\Api), 'json') #19 src/XF/App.php(1931): XF\Mvc\Dispatcher->run() #20 src/XF.php(329): XF\App->run() #21 api/index.php(4): XF::runApp('Xfrocks\\Api\\App') #22 {main}
Cái này fix chung luôn tránh lỗi sau này hén. Không có entity -> bỏ transform luôn (chắc là return []?).
return []