Sometimes we need to write custom insert query in magento2 as per business logic or client requirement.

In this blog, We will create some standard code to insert data using custom insert.

We need to use magento ResourceConnection class for insert data in mysql table.

Here we are adding a new record in custom table call_logs, that contains three columns only id, external_number and duration

PHP
<?php
declare(strict_types=1);

namespace MageDad\Module\Model;

use Magento\Framework\App\ResourceConnection;

class CallLogManagement
{
    public function __construct(
        private ResourceConnection $resourceConnection,
    ) { }
    
    public function saveCallLog()
    {
        $data = [
            'external_number' => '09876543210',
            'duration' => 100
        ];
        
        $connection  = $this->resourceConnection->getConnection();
        $tableName = $connection->getTableName('call_logs');
        $connection->insert($tableName, $data);
        
        
        $data = [
            [
                'external_number' => '09876543210',
                'duration' => 100
            ],
            [
                'external_number' => '09876543211',
                'duration' => 200
            ]
        ];
        $connection->insertMultiple($tableName, $data);
    }
}

Above code in we used insert function for single record call_logs table. We have function insertMultiple for more then one record.

I hope this blog is useful to custom insert query in magento2. In case, I missed anything or need to add some more information, Don’t heisted to leave a comment in this blog, I’ll get back with some positive approach.

Keep loving ❤️ Keep inspiring 🤩 Keep liking 👍 No sharing 😄

29 Comments

  1. Hi there just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the issue fixed soon. Kudos

  2. User-Friendly Interface and Accessibility Businessiraq.com is designed with a focus on user experience, ensuring that visitors can easily navigate the site to find the information they need. With a clean layout and intuitive search functions, users can swiftly access the Iraq Business Directory, job listings, and the latest business news. This commitment to user-friendly design not only enhances engagement but also contributes positively to SEO, as search engines prioritize websites that provide a seamless browsing experience. By making essential business information easily accessible, Businessiraq.com positions itself as the premier online resource for anyone looking to thrive in the Iraqi business environment.

  3. Neu anh em dang tim kiem mot nha cai truc tuyen uy tin de tham gia ca cuoc, thi xo88chinh la lua chon ly tuong. Day la nen tang ca cuoc hang dau mang den trai nghiem chuyen nghiep va chat luong cao voi hang loat tro choi da dang, hap dan. xo88.name

  4. Excellent beat ! I wish to apprentice at the same time as you amend your website, how could i subscribe for a blog web site? The account helped me a appropriate deal. I have been a little bit acquainted of this your broadcast provided bright transparent idea

  5. Everything is very open and very clear explanation of issues. was truly information. Your website is very useful. Thanks for sharing.

  6. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  7. Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

  8. 이러한 유형의 주제를 검색하는 거의 모든 사람들에게 도움이되기를 바랍니다. 저는이 웹 사이트가 그러한 주제에 가장 적합하다고 생각합니다. 좋은 작품과 기사의 품질. 벳톡카지노

  9. That is really fascinating, You’re an overly professional blogger. I have joined your feed and look forward to seeking more of your magnificent post. Additionally, I’ve shared your site in my social networks!

  10. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  11. Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

  12. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  13. Hello would you mind letting me know which hosting company you’re utilizing? I’ve loaded your blog in 3 different web browsers and I must say this blog loads a lot quicker then most. Can you suggest a good internet hosting provider at a honest price? Cheers, I appreciate it!

  14. In conclusion, while anabolic Effect steroids undoubtedly supply a plethora of advantages, it’s crucial to
    strategy their use with warning and accountability. So say goodbye
    to like handles and hello to a leaner, extra outlined you, due
    to the fat-reducing powers of anabolic steroids. So, whether
    you’re chasing gold medals or private bests, anabolic
    steroids can be the important thing to unlocking your full
    athletic potential. When it involves pushing the bounds of human performance,
    anabolic steroids are like rocket fuel for the physique.
    This is achieved via the stimulation of protein synthesis and nitrogen retention in the muscle
    tissues, resulting in rapid increases in muscle mass and overall energy.
    They are known for their capacity to promote the growth of skeletal muscle (anabolic effects) and the development of male traits (androgenic
    effects).
    It seems counterintuitive given the drug’s status primarily for muscle achieve, nevertheless
    it indeed presents some assist. Throughout its heyday,
    a quantity of high-profile athletes reportedly utilized the substance to improve their performance and achieve higher results.
    Consequently, these successes fueled curiosity in the drug and led to increased reputation and experimentation within the athletic and bodybuilding communities.

    When a pharmaceutical firm referred to as Syntex studied Anadrol for analysis purposes, it first appeared on the scene in 1959.
    They found Anadrol to be a successful treatment for anemia, osteoporosis,
    and muscle-wasting situations similar to HIV/AIDS. So, what I’ve provided above is a tenet that can only be used as a vital
    guide. I’m often discovering new and better ways to do things, like changing doses barely or timing, and so forth.

    These specifics are actions we will solely really experiment
    with ourselves, and TAKE NOTE of the pros and cons of everything you
    try. Some steroids shall be more fat-soluble than others and so detectable for longer periods due to
    them remaining within the fats tissue.
    At their core, anabolic steroids speed up protein synthesis, a biological
    course of that allows cells to construct proteins.
    Proteins are the building blocks of muscle tissue,
    and by rushing up this course of, anabolic steroids permit customers to experience significant muscle positive aspects
    in a brief interval. Nevertheless, this accelerated growth comes with a cost when it comes to
    well being risks and moral concerns. Primobolan is an anabolic steroid derived from dihydrotestosterone (DHT) that promotes muscle
    development and improves efficiency.
    When it involves the use of performance-enhancing drugs
    like Oxymetholone, a weighted understanding of benefits and risks is indispensable.

    Balancing these aspects with personal fitness objectives whereas
    staying throughout the legislation could be a notable
    challenge. In the United States, Oxymetholone is totally legal
    for personal use, however issues might come up if acquired for resale, as it’s prohibited for such activities.

    It’s not doping, it’s for your health.” Yeah, it had testosterone in it. And that was the second, he handed me this capsule, that was the second. The primary medical use of these compounds is to deal with circumstances such as hypertension, kidney disease, and congestive heart failure. Taken without medical supervision, diuretics may find yourself in potassium depletion and probably even death. Stacking requires cautious planning to balance benefits with potential unwanted effects.
    However you must consider the potential additional optimistic advantages and unwanted aspect effects you’ll get (if any). Stacking means you’re also introducing a new set of unwanted effects, plus amplifying any negatives that each compound shares16. Another frequent strategy is to stack a dry SARM with one that promotes fats loss. This creates a slicing or contest prep stack involving dry SARMs like Ostarine, RAD-140, or S4 combined with SR-9009 or Cardarine. It can mimic the features of ghrelin, which boosts IGF-1 and development hormone levels. Cardarine is a PPAR (Peroxisome Proliferator Activated Receptor) agonist.
    But worse than losing cash, in that case, is being caught shopping for steroids illegally (see the legal part above). These effects come about as a outcome of how androgens have an result on the physique and when estrogen operate is altered. Wanting for ways to make the process easier is sensible when you’re on this position.
    This is an 8-week cycle you could optionally taper off on the final week. If your SARM bottle says 20mg/ml, this means for every ml that you simply extract from the bottle, you’ll get 20mg of the SARM. On the opposite hand, most SARMs have a low dosage requirement, so that you need only to take out minimal quantities of liquid. In the above example, if you need simply 10mg, you’d solely require zero.5ml from that bottle.
    Nonetheless, Winstrol is phenomenal in other areas, particularly bettering performance and chopping and weight-reduction plan, the place the principle goal is to realize a really lean, dry, exhausting, and defined physique. This means such a brief cycle might be favored by people with particular causes to run a cycle of this length rather than a standard one. Anavar will promote fat loss and comes with some advantages for recovery.

  15. Authorized steroids, or steroid options, are FDA-approved formulation that
    mimic the consequences of anabolic steroids.

    However, not all people reply the identical (just like
    with anabolic steroids), so some folks can make more positive aspects than others.
    A person’s training and food regimen are also crucial in determining results.
    For best outcomes, it must be stacked with different authorized
    steroids, as outcomes are minimal with HGH-only cycles
    in our expertise. Primarily Based on our exams, Anadrol is possibly the worst anabolic
    steroid for the center and liver. Due To This Fact, it is typically averted by steroid users who
    opt to go for lighter steroids, which can nonetheless yield impressive results (such as testosterone or Dianabol).
    Sustanon 250 is an efficient testosterone ester used in bulking cycles to add
    important quantities of muscle and power.
    Likewise, you will obtain higher energy acquire via bench presses, squats, and deadlifts.
    If you haven’t used steroids before, you might be questioning
    what “steroid cycles” truly mean and what’s the proper approach to
    implement them. Hence, we’ve gone the extra step to
    incorporate this part in today’s information. As far because the
    cycle is anxious, we strongly suggest beginning with a low
    dose before progressively increasing the amount. This helps the body get accustomed to the compound without going
    through the risk of creating severe unwanted effects.

    Though there’s no denying that steroids help with quicker muscle constructing,
    most bodybuilders understand that utilizing steroids alone won’t meet their necessities.
    That’s why they mix their steroid consumption with the proper exercise and food plan regimes to obtain optimum benefits.

    Thus, customers could want to maintain a SERM (selective
    estrogen receptor modulator) shut by in case their nipples start
    to become puffy. Frequently assessing and fine-tuning coaching quantity allows bodybuilders to unlock their full
    potential of their fitness endeavors. Whereas different variables certainly matter, coaching volume
    stays a pivotal consider achieving fitness targets effectively and effectively.
    After a deload, you usually expertise improved performance due
    to higher restoration. Notice that individual responses vary,
    so modify these methods primarily based on your
    distinctive needs such as when usining muscle steroids.

    This is why performance-enhancing drugs aren’t allowed for use in sports activities.
    The three are the best steroid stacks for bulking
    within the bodybuilding world. It likewise helps to lower the natural
    testosterone production in your body. Thus, if you use Anadrol, you should endure a careful
    post-cycle therapy (PCT) routine proper after completing
    your cycle. Like different anabolic steroids,
    Deca Durabolin has dangerous unwanted effects (31, 32).
    It can also be among the finest steroids for bulking, massive energy building,
    improved endurance, joint ache relief, and quick restoration. These include vomiting, nausea, hair loss, change in skin color, oily skin, pimples, stroke,
    coronary heart attack, irregular bone growth, and mental problems.

    Whereas it’s onerous to estimate their influence
    on CVD risk, one may try to quantify it by wanting on the
    – well-researched – results of blood pressure-lowering medication. Every 10 mmHg reduction in systolic blood strain reduces the chance
    of major cardiovascular occasions, coronary heart disease, stroke, coronary heart failure, and
    all-cause mortality by 20%, 17%, 27%, 28%, and 13%,
    respectively (95). A persistent pharmacological enhance in blood strain – similar to attributable to AAS use
    – may be speculated to have the inverse impact.
    There does appear to be a disconnect between self-reporting of
    this facet effect and visible examination by a physician. In the HAARLEM research,
    the prevalence of self-reported zits elevated
    from 10% at the start of a cycle to 52% at the
    finish, whereas visual examination by a doctor confirmed a smaller increase from 13% to 29%
    (39). The discrepancy could be largely ascribed to AAS users classifying a few pimples as pimples.

    He attributed the harm to his coronary heart as the outcomes of his
    personal experimental steroid use (when creating Dianabol).
    This spike in vascularity is as a end result of of Dianabol’s vasodilation impact,
    the place blood vessels dilate and turn into bigger in measurement,
    thus being positioned closer to the floor of the pores and skin. In comparability, complete testosterone by itself has
    no impact on body composition; nonetheless, each of these readings will
    rise significantly when taking Dianabol. If an individual is discovered promoting steroids, the utmost punishment is 5 years in jail and a
    $250,000 nice.
    Varied anabolic steroids are efficient for bulking up and gaining muscle mass.
    Nevertheless, only some compounds are able to burning fat and constructing muscle concurrently.
    When seeking to increase muscle acquire and strength, many athletes and bodybuilders turn to testosterone for muscle development.
    Testosterone is known for its capability to reinforce muscle mass, promote power
    and power positive aspects, and enhance overall athletic
    efficiency. It is often thought-about top-of-the-line steroids for
    achieving these targets. We find that Testo-Max is finest used
    in bulking cycles, maximizing testosterone ranges and mass gain.
    Mechanical failure has been advised as a mechanism in anabolic steroid-using athletes.
    Skeletal muscle adaptations (i.e. hypertrophy and power increases) happen quite quickly compared
    to connective tissue. Subsequently, tendon accidents in athletes are thought to happen from
    a rapid improve in training depth and volume where connective tissue fails
    to withstand the overload. One study has shown that top doses of anabolic
    steroids lower the degradation and enhance the synthesis of kind I collagen (Parssinen et al., 2000).
    Evans and colleagues (1998) performed an ultrastructural evaluation on ruptured tendons from anabolic steroid customers.
    They concluded that anabolic steroids did not induce
    any ultrastructural collagen modifications that would enhance the chance of tendon ruptures.
    Although the incidences of tendon rupture in anabolic steroid customers shouldn’t be discounted, it is important to contemplate it in relation to
    the mechanical stress encountered from the speedy increases in muscular efficiency.

    Thus, regardless of testosterone’s highly effective anabolic
    nature, it can also be used as a slicing steroid. Testosterone is
    often used as the primary steroid cycle, which generally produces 20–25 lbs in mass.
    The nickname “A-Bombs” for Anadrol is fitting, as its physiological effects resemble dropping a bomb on the liver.

    We have seen in depth cycles and high doses trigger excessive
    amounts of hepatic injury and, in some instances, trigger cirrhosis.

    In our experience, testosterone suppression with Dianabol is often important, with
    endogenous ranges taking several months to revive to regular ranges.
    A PCT, including a SERM such as clomiphene, can help shorten this recovery
    period.
    Dianabol (methandrostenolone) doesn’t just aromatize; it additionally
    converts to 17 alpha-methylestradiol, which is basically a form of
    estrogen considerably stronger than estradiol. This conversion, mixed
    with its current aromatizing attributes, creates a
    moderately estrogenic compound. For a bodybuilder, a higher pink blood
    cell count may end up in extra repetitions being accomplished throughout sets, thus with the ability to prepare for longer periods
    of time. This superior capability to recuperate is how Arnold Schwarzenegger and other classic bodybuilders may get away with training for several
    hours each day (intensely) with out overexerting themselves.
    Nevertheless, it is legal to acquire Dianabol (and different
    steroids) at present in countries similar to Mexico, where they can be bought over the counter
    at a close-by Walmart retailer or local pharmacy.

  16. Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

  17. I have been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the internet will be much more useful than ever before.

Write A Comment