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

Add possibility to create Stock and Source with predefined identifier #79

Merged
merged 5 commits into from
Sep 4, 2017

Conversation

naydav
Copy link

@naydav naydav commented Sep 4, 2017

@magento-cicd2
Copy link

magento-cicd2 commented Sep 4, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@@ -17,6 +17,11 @@
*/
class Source extends AbstractDb
{
/**
* Provide possibility of save entity with predefined id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of saving

use Magento\Framework\Model\AbstractModel;

/**
* Provide possibility of save entity with predefined id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provides ... of saving predefined/pre-generated


/**
* Provide possibility of save entity with predefined id
* Use trait instead of extending for better reusability, also we don'nt want to hardcode hierarchy of inheritance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The choice to use trait instead of inheritance was made to prevent the introduction of new layer super type on the module basis as well as better code reusability, as potentially current trait not coupled to Inventory module and other modules could re-use this approach.

trait PredefinedId
{
/**
* Check if object is new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overwrite default AbstractModel implementation of the function isObjectNew
@see origina

adding the possibility to check whether (record) already exists in DataBase or not

@@ -13,6 +13,11 @@
*/
class Stock extends AbstractDb
{
/**
* Provide possibility of save entity with predefined id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provides

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

Successfully merging this pull request may close these issues.

3 participants