akeneo-pim-system-info_2016-06-16_14-41.txt
Probably the same as in https://github.com/akeneo/pim-community-dev/issues/2644 (which is closed without an explanation)
When adding values to product attrbiutes via the mass-edit the versioning gets updated with the correct timestamp, but the products updated timestamp is not.
This can be verified by mass editing one product and running the php app/console --env=prod pim:product:query '[{"field":"updated","operator":">= WITH TIME","value":"YYYY-MM-DD HH:mm:ss"}]'
This has a major impact to some export profiles that uses the EnhancedConnectors fromLastExecution
option.
Note. MongoDB is in use -> Mass edit will use \Pim\Bundle\CatalogBundle\Doctrine\MongoDBODM\Saver\ProductSaver::saveAll
So, this might have to do with the fact that the \Pim\Bundle\CatalogBundle\EventSubscriber\TimestampableSubscriber
is only listening to Doctrines prePersist
and preUpdate
events. The \Pim\Bundle\CatalogBundle\Doctrine\MongoDBODM\Saver\ProductSaver::saveAll
does not emmit those events at all.
After looking into it, the dates do get created in \Pim\Bundle\TransformBundle\Normalizer\MongoDB\ProductNormalizer::normalize
when executing the saveAll
. Still a mystery why the EnhancedConnectors fromLastExecution
does not take into account these products. Is there a timezone missmatch somewhere?
It seems that the MondoDB's normalizedData.updated
doesn't get updated...
Hi Matias,
What do mean by "When adding values to product attributes"? Did you try to change a common product value? I tried to reproduce it on a fresh install but the updated_at
product field has been updated well.
In your system info, there is not EnhancedConnectors
, normal ?
What do mean by "When adding values to product attributes"? Did you try to change a common product value? I tried to reproduce it on a fresh install but the updated_at product field has been updated well.
Yes, change which ever attribute so that the product is marked for changes, thus to be persisted.
In your system info, there is not EnhancedConnectors, normal ?
Irrelevant
When doing mass edits (what ever methods that will call the \Pim\Bundle\CatalogBundle\Doctrine\MongoDBODM\Saver\ProductSaver::saveAll
) the following will be called \Pim\Bundle\TransformBundle\Normalizer\MongoDB\ProductNormalizer::normalize
As we're in the 1.4.x branch well see that the products _updated_ value is updated here
https://github.com/akeneo/pim-community-dev/blob/v1.4.25/src/Pim/Bundle/TransformBundle/Normalizer/MongoDB/ProductNormalizer.php#L87
But queries through the mongo handler is targeted against the products normalizedData
and that does not get updated with the new created
and updated
timestamps (https://github.com/akeneo/pim-community-dev/blob/v1.4.25/src/Pim/Bundle/TransformBundle/Normalizer/MongoDB/ProductNormalizer.php#L99).
As a workaround we're listening to the akeneo.storage.pre_save_all
event and update the products timestamps there.
Relates / duplicated by #5006
@aRn0D this is not a question, it is a bug; as per #5006 is works in ORM mode but not in ODM
Up.
I reproduced that bug in our PIM instance.
The normalizer updates the "root" field updated on the fly but does not update it to the product object. So, as @mathewrapid said :
Product updated field and normalizedData.updated are always out of sync. NormalizedData is one step late.
I think that the normalizer never has to do $data['updated'] = $this->mongoFactory->createMongoDate();
if the data is set in the product model. It is a normalizer, not an updater.
The fact is that the product has to be updated (so updated field) before normalization.
+1
Hi @mathewrapid, @jlestel, @bmarrot !
FYI, this issue (PIM-6038) has been fixed in following versions,
Best regards,
Imo. can be closed. Opinions?
As @nidup pointed out in https://github.com/akeneo/pim-community-dev/issues/4620#issuecomment-279428030, this has been fixed in PIM-6038.
Most helpful comment
Imo. can be closed. Opinions?