Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass edit - Updated At #4620

Closed
mathewrapid opened this issue Jun 16, 2016 · 11 comments
Closed

Mass edit - Updated At #4620

mathewrapid opened this issue Jun 16, 2016 · 11 comments

Comments

@mathewrapid
Copy link
Contributor

mathewrapid commented Jun 16, 2016

akeneo-pim-system-info_2016-06-16_14-41.txt

Probably the same as in #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

@mathewrapid
Copy link
Contributor Author

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.

@mathewrapid
Copy link
Contributor Author

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?

@mathewrapid
Copy link
Contributor Author

It seems that the MondoDB's normalizedData.updated doesn't get updated...

@arnolanglade
Copy link
Contributor

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 ?

@mathewrapid
Copy link
Contributor Author

mathewrapid commented Jun 21, 2016

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.

@mathewrapid
Copy link
Contributor Author

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

@nimasan
Copy link

nimasan commented Feb 13, 2017

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.

@jlestel
Copy link

jlestel commented Feb 13, 2017

+1

@nidup
Copy link
Contributor

nidup commented Feb 13, 2017

Hi @mathewrapid, @jlestel, @BMarrot !

FYI, this issue (PIM-6038) has been fixed in following versions,

Best regards,

@nidup nidup added this to the 1.5.x milestone Feb 13, 2017
@mathewrapid
Copy link
Contributor Author

Imo. can be closed. Opinions?

@mathewrapid
Copy link
Contributor Author

As @nidup pointed out in #4620 (comment), this has been fixed in PIM-6038.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants