Symfony2 Federated Query Implementation method, Symfony2 Federated Query _php tutorial

Source: Internet
Author: User

Symfony2 Federated Query Implementation method, Symfony2 union query


This paper describes the implementation method of Symfony2 federated query. Share to everyone for your reference, as follows:

1.YML file

Acme\mspadminbundle\entity\msparticle:type:entity table:msp_article manytoone:  Channel:   targetEntity: Mspchannel   inversedby:articles   joincolumn:    name:channel_id    referencedcolumnname:channel_id  User:   targetentity:mspuser   inversedby:userone   joincolumn:    name:user_id    referencedcolumnname:user_id
Acme\mspadminbundle\entity\mspchannel:type:entity table:msp_channel onetomany:   Articles:    targetEntity: Msparticle    Mappedby:channel
Acme\mspadminbundle\entity\mspuser:type:entity table:msp_user onetomany:   userone:    targetEntity: Msparticle    Mappedby:user

2. Query code:

$sql = "Select A.id,a.checkstatus,a.title,a.releasesysdate,          a.visittotal,u.username, n.name from Acmemspadminbundle:msparticle a          join A.user u join a.channel n "; $query = $emt->createquery ($sql.") Where a.checkstatus = 0 "); $mspArtile = $query->getresult ();

It is hoped that this article is helpful to the PHP program design based on Symfony framework.

Articles you may be interested in:

    • Symfony2 Creating a Page instance
    • Analysis of date usage in twig of symfony2.4
    • Summary of Symfony2 's session and cookie usage
    • Symfony2 a summary of how to achieve data acquisition from a database
    • Symfony2 Framework Learning Notes Form usage
    • Analysis of plugin format of Symfony2 learning notes
    • Symfony2 Study Notes System routing
    • Symfony2 study notes of the controller usage detailed
    • Symfony2 Study Notes Template usage detailed
    • Symfony2 installing a third-party bundles instance
    • An example analysis of Symfony2 function usage

http://www.bkjia.com/PHPjc/1111901.html www.bkjia.com true http://www.bkjia.com/PHPjc/1111901.html techarticle Symfony2 Union Query implementation method, Symfony2 joint Query This article describes the Symfony2 federated query implementation method. Share to everyone for your reference, as follows: 1.yml file Acme\ms ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.