Magento2 getting single row by field from repository objectFetch Single Record from Custom Module TableMagento2: What's the best way to add custom payment method field?Magento2: Multiple stores (groups) under single websiteSimple Magento2 example of retrieving and displaying a custom table field?Update custom column data in quote table Magento 2Magento:2 How to save unique values for my custom admin moduleGetting product object inside defaultinvoice.php file for getting custom attribute valuesHow to expose a custom field from sales_order table to rest api?Magento 2 Add Record to Custom TableMagento 2 how to Load custom collection data using AjaxGetting a table first row from repository
A case of the sniffles
Does detail obscure or enhance action?
expand `ifthenelse` immediately
Operational amplifier as a comparator at high frequency
Paid for article while in US on F-1 visa?
Is it unprofessional to ask if a job posting on GlassDoor is real?
A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?
Why do I get two different answers for this counting problem?
Can you really stack all of this on an Opportunity Attack?
Why can't we play rap on piano?
Replacing matching entries in one column of a file by another column from a different file
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
Did Shadowfax go to Valinor?
What does it mean to describe someone as a butt steak?
I'm flying to France today and my passport expires in less than 2 months
What does "Puller Prush Person" mean?
Is it possible to run Internet Explorer on OS X El Capitan?
Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?
Get value of a counter
What's that red-plus icon near a text?
"You are your self first supporter", a more proper way to say it
Perform and show arithmetic with LuaLaTeX
Theorems that impeded progress
How to regain access to running applications after accidentally zapping X.org?
Magento2 getting single row by field from repository object
Fetch Single Record from Custom Module TableMagento2: What's the best way to add custom payment method field?Magento2: Multiple stores (groups) under single websiteSimple Magento2 example of retrieving and displaying a custom table field?Update custom column data in quote table Magento 2Magento:2 How to save unique values for my custom admin moduleGetting product object inside defaultinvoice.php file for getting custom attribute valuesHow to expose a custom field from sales_order table to rest api?Magento 2 Add Record to Custom TableMagento 2 how to Load custom collection data using AjaxGetting a table first row from repository
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am building an ajax using webapi. and it instantiates a repository model.
How do I load a single row by a field?
I need to check if an email already exist in the table.
magento2 magento-2.1
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am building an ajax using webapi. and it instantiates a repository model.
How do I load a single row by a field?
I need to check if an email already exist in the table.
magento2 magento-2.1
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47
add a comment |
I am building an ajax using webapi. and it instantiates a repository model.
How do I load a single row by a field?
I need to check if an email already exist in the table.
magento2 magento-2.1
I am building an ajax using webapi. and it instantiates a repository model.
How do I load a single row by a field?
I need to check if an email already exist in the table.
magento2 magento-2.1
magento2 magento-2.1
asked May 28 '17 at 7:48
dondon
362
362
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 7 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47
add a comment |
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47
add a comment |
1 Answer
1
active
oldest
votes
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f176360%2fmagento2-getting-single-row-by-field-from-repository-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();
add a comment |
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();
add a comment |
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();
I think you can load first item as follows from model.
$firstItem = $repositoryObject->create()->getCollection()->getFirstItem();
And if you want field name then as follows.
$firstItemField = $repositoryObject->create()->getCollection()->getFirstItem()->getXxx();
answered May 28 '17 at 12:49
Kishan PatadiaKishan Patadia
3,8451925
3,8451925
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f176360%2fmagento2-getting-single-row-by-field-from-repository-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Loading an object from model or can say getting one row from table is same as it's in magento1 see this link magento.stackexchange.com/questions/33019/… , the only difference is to load or initiate a model or collection.
– Kumar M
May 28 '17 at 12:47