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 ...