Open taylor19882002 opened 9 years ago
Hi, it's because filter_unresolved
will remove from collection actions with unresolved components.
Here, if a\model (primary key: chuckNorris)
cannot be resolved (does not exist if you didn't write a new resolver), it'll remove the action from collection.
Thank you for your reply. But I use ODM driver, after I trace previous related issues, Need to set the Identifier ? sorry I'm just a novice of symfony, not well understand.
I'm not sure to understand what do you say.
Yes, you have to persist your entities (in ORM or ODM) before pushing them into timeline as component.
Hi Stephpy, I still in a error. T.T
Now, I create a User class as the component, when filter_unresolved = true, it can show someone timeline with no spread, but when I add-on the spread service, if the timeline include another user action get below error. if no enable data_hydrator can be ok. I have not idea, how to solve it. I 'm trying to understand the DataHydrator logic.
ContextErrorException: Notice: Array to string conversion in /............/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Query/Builder.php line 333 at ErrorHandler->handle('8', 'Array to string conversion', '/............/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Query/Builder.php', '333', array('field' => array('id'), 'this' => object(Builder))) in /............/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Query/Builder.php line 333 at Builder->field(array('id')) in /............/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Query/Builder.php line 121 at Builder->field(array('id')) in /.........../vendor/stephpy/timeline-bundle/Filter/DataHydrator/Locator/DoctrineODM.php line 64 at DoctrineODM->locate('Acme\StoreBundle\Document\User', array('Acme\StoreBundle\Document\User#s:24:"547429bad03b7c4704b7ad5e";' => object(Component))) in /.........../vendor/stephpy/timeline/src/Filter/DataHydrator.php line 101 at DataHydrator->hydrateComponents(object(Pager)) in /.........../vendor/stephpy/timeline/src/Filter/DataHydrator.php line 68
You entity has a composite key ? It seems error come from:
https://github.com/stephpy/timeline-bundle/blob/master/Filter/DataHydrator/Locator/DoctrineODM.php#L62 which give $field
as an array, it should not.
No entity as array ( '_id' => '547429bad03b7c4704b7ad5e', 'username' => 'morris', )
If you dump $field
here, what does it returns ?
Array ( [0] => id )
Try to add $field = current($field);
before line 62.
That error has removed, Thank you so much!
I'll make a patch as soon as possible.
hm.... I find something out of my expectation. let me re-explain the old question DataHydrator filter_unresolved = true can be filter out the action push from some guys and already removed from their timeline, that action will not show up in my timeline, Am i right ?
It is explained in documentation, cannot be more explicit.
DataHydrator filter_unresolved = true not work in ODM, that's why I ask above question. By the way, I really thank you for your reply.
I remove a directComplement which referring in a timeline, when I pull the timeline get the error show as:
The "MongoDBODMProxiesCG\Acme\StoreBundle\Document\Component" document with identifier "547450f6d03b7c4304b7ad7d" could not be found. at DocumentNotFoundException ::documentNotFound ('MongoDBODMProxiesCG\Acme\StoreBundle\Document\Component', '547450f6d03b7c4304b7ad7d') in/...../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Proxy/ProxyFactory.php at line 176 + at ProxyFactory ->Doctrine\ODM\MongoDB\Proxy{closure} (object(Component), 'getData', array()) in kernel.root_dir/cache/dev/doctrine/odm/mongodb/Proxies/CGAcmeStoreBundleDocumentComponent.php at line 243 + at Closure ->__invoke (object(Component), 'getData', array()) in kernel.root_dir/cache/dev/doctrine/odm/mongodb/Proxies/CGAcmeStoreBundleDocumentComponent.php at line 243 + at Component ->getData () in /..../vendor/stephpy/timeline/src/Filter/DataHydrator/Entry.php at line 59 + at Entry ->buildComponent (object(ActionComponent)) in /....../vendor/stephpy/timeline/src/Filter/DataHydrator/Entry.php at line 44 + at Entry ->build () in /...../vendor/stephpy/timeline/src/Filter/DataHydrator.php at line 63 + at DataHydrator ->filter (object(Pager)) in /...../vendor/stephpy/timeline/src/Filter/FilterManager.php at line 40
I don't use ODM, did you find something which could fix this usecase ?
Hi Stephpy
I'm not sure that problem is my misunderstand or not
my problem 1) create $actionManager = $this->get('spy_timeline.action_manager'); $subject = $actionManager->findOrCreateComponent('a\model', 'chucknorris'); $action = $actionManager->create($subject, 'control', array('directComplement' => 'the world')); $actionManager->updateAction($action);
2) get timeline $actionManager = $this->get('spy_timeline.action_manager'); $timelineManager = $this->get('spy_timeline.timeline_manager'); $subject = $actionManager->findOrCreateComponent('a\model', 'chucknorris'); $timeline = $timelineManager->getTimeline($subject);
if filter_unresolved = false, get the related items {"coll":{"items":[..........],"last_page":1,"page":1,"nb_results":1}}
if filter_unresolved = true, get nothing, i don't know why it filter out self action. {"coll":{"items":[],"last_page":1,"page":1,"nb_results":1}}
regards Oscar