Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
There are many widgets present in Odoo user interface to perform different functionalities. Status bar, Checkboxes, Radio button etc. make the operations in Odoo simpler. In this blog, I will be explaining about different default widgets in Odoo, its purpose, and implementation syntax..
There are many widgets present in Odoo user interface to perform different functionalities. Status bar, Checkboxes, Radio button etc. make the operations in Odoo simpler. In this blog, I will be explaining about different default widgets in Odoo, its purpose, and implementation syntax..
Objetivo: Capacitar al estudiante para crear procedimientos almacenados, funciones y disparadores haciendo uso de los elementos, sentencias y estructura de programación adecuados para la programación en SQL, que le permitan resolver requerimientos de la vida real
• Create a new ADF Skin and check Skin values being used
• Change the page background and font family
• Update the look and feel for table headers and links
• Change the pane body and shape of tabs
• Implement dynamic skin change
Empower your App by Inheriting from Odoo MixinsOdoo
Empower your App by Inheriting from Odoo Mixins. Let us recode everything from scratch! Or not.
Thibault Delavallee, Software Engineer, RD Marketing Team Leader, Odoo
Based on work from Yannick Tivisse, Martin Trigaux, and Damien Bouvy.
Practica- Transacciones y Concurrencia en Oracle y MySQLIvan Luis Jimenez
Práctica de Transacciones y Concurrencia en Oracle y MySQL
Desde el simbolo del sistema de Windows
Ejemplo de transacciones en Oracle
Ejemplo de transacciones en MySQL
You’ve seen Kris’ open source libraries, but how does he tackle coding out an application? Walk through green fields with a Symfony expert as he takes his latest “next big thing” idea from the first line of code to a functional prototype. Learn design patterns and principles to guide your way in organizing your own code and take home some practical examples to kickstart your next project.
The REST API is an awesome plugin to expose your data from the WordPress core. But … the standard implementation might not fit your specific case.
Just like the WordPress core, you'll be able to extend it to your specific needs. I'll show you how to handle authentication, introduce caching strategies, alter custom post types, or even change the default way of communication altogether.
Objetivo: Capacitar al estudiante para crear procedimientos almacenados, funciones y disparadores haciendo uso de los elementos, sentencias y estructura de programación adecuados para la programación en SQL, que le permitan resolver requerimientos de la vida real
• Create a new ADF Skin and check Skin values being used
• Change the page background and font family
• Update the look and feel for table headers and links
• Change the pane body and shape of tabs
• Implement dynamic skin change
Empower your App by Inheriting from Odoo MixinsOdoo
Empower your App by Inheriting from Odoo Mixins. Let us recode everything from scratch! Or not.
Thibault Delavallee, Software Engineer, RD Marketing Team Leader, Odoo
Based on work from Yannick Tivisse, Martin Trigaux, and Damien Bouvy.
Practica- Transacciones y Concurrencia en Oracle y MySQLIvan Luis Jimenez
Práctica de Transacciones y Concurrencia en Oracle y MySQL
Desde el simbolo del sistema de Windows
Ejemplo de transacciones en Oracle
Ejemplo de transacciones en MySQL
You’ve seen Kris’ open source libraries, but how does he tackle coding out an application? Walk through green fields with a Symfony expert as he takes his latest “next big thing” idea from the first line of code to a functional prototype. Learn design patterns and principles to guide your way in organizing your own code and take home some practical examples to kickstart your next project.
The REST API is an awesome plugin to expose your data from the WordPress core. But … the standard implementation might not fit your specific case.
Just like the WordPress core, you'll be able to extend it to your specific needs. I'll show you how to handle authentication, introduce caching strategies, alter custom post types, or even change the default way of communication altogether.
https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes - origin
Laravel 5.1 raised the bar for framework documentation, but there's much, much more lurking beneath the surface. In this 50-minute session, we'll explore 50 (yes, 50!) high-leverage implementation tips & tricks that you just won't find in the docs: the IoC Container, Blade, Eloquent, Middleware, Routing, Commands, Queues, Events, Caching — we'll cover them all! Join us as we drink from the fire hose & learn to take advantage of everything that Laravel has to offer to build better software faster!
Refactoring, Agile Entwicklung, Continuous Integration – all diese für nachhaltigen Erfolg wichtigen Vorgehensweisen setzen Erfahrung mit Unit Testing voraus. Abseits von den üblichen "Bowling"-Beispielen möchten wir gerne einen Crashkurs inkl. Best Practices für das erfolgreiche Unit Testing durchführen. Anhand eines Beispielprojekts auf Basis des Zend Frameworks werden wir nach der Installation von PHPUnit auf allen Notebooks gemeinsam eine kleine Applikation aufbauen, die durchgehend Test-driven entwickelt wird.
All projects start with a lot of enthusiasm. As many projects grow the technical debt gets bigger and the enthusiasm gets less. Almost any developer can develop a great project, but the key is maintaining an ever evolving application with minimal technical debt without loosing enthusiasm.
During this talk you will be taken on the journey of application design. The starting point is an application that looks fine but contains lots of potential pitfalls. We will address the problems and solve them with beautiful design. We end up with testable, nicely separated software with a clear intention.
Харьковский WordPress MeetUp #2: http://wp.org.ua/?p=191
Какими навыками должен обладать WordPress Гуру (junior, middle, senior) и какие этапы роста проходит WP-разработчик, а также опишет путь от настройки простейшего блога для друга и мелкого фриланса до участия в масштабных Open Source проектах и карьеры в крупной компании. Доклад даст нужное направление для развития новичкам и поможет упорядочить мысли более опытным разработчикам.
Видео будет доступно немного позже.
We, as developers, often think that we don’t have to or don’t need to know what are what they call design patterns. We think that we already know how to build a software and don’t need all this theory. Years after years, by having to deal with the low maintainability of my own codebases, I explored a lot of ways of decoupling applications, in order to have enterprise-grade software that last for years. With concrete examples, I want to share with you some design patterns and how they can help you to grow well structured and decoupled applications.
Building Lithium Apps (Like a Boss) was a workshop presented on the structure and philosophy of the Lithium framework and its applications, and how best to take advantage of them.
The REST API is an awesome plugin to expose your data from the WordPress core. But … the standard implementation might not fit your specific case.
Just like the WordPress core, you'll be able to extend it to your specific needs. I'll show you how to handle authentication, introduce caching strategies, alter custom post types, or even change the default way of communication altogether.
Doctrine 2: Enterprise Persistence Layer for PHPJonathan Wage
Doctrine 2 is an object relational mapper (ORM) for PHP 5.3+ that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
2. Who am I?
- CTO of MoreCommerce.com
- Using PHP for 15 years
- Involved with Doctrine and
Symfony development for 10
years
3. What is MoreCommerce?
- E-commerce seller tools and
consumer marketplaces.
- Wholly owned subsidiary of
Alibaba Group
- 100,000 Sellers
- 80M Active Shoppers
- Billions in GMV runs through
MoreCommerce platforms
4. ● Open source PHP project started in 2006
● Initially only an Object Relational Mapper
● Evolved to become a collection of high
quality PHP packages focused on
databases and persistence related
functionality
What is Doctrine?
14. $ php bin/console doctrine:migrations:generate
A database migration is an incremental, reversible change to a relational
database schema.
You define the change to your database schema in a PHP class. Use the
doctrine:migrations:generate command to generate a new blank migration.
What is a Database Migration?
15. Generated Database Migration
final class Version20181012002437 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
}
}
16. Write Your Migration
public function up(Schema $schema) : void
{
$usersTable = $schema->createTable('user');
$usersTable->addColumn('id', 'integer', ['autoincrement' => true, 'notnull' => true]);
$usersTable->addColumn('username', 'string', ['length' => 255]);
$usersTable->setPrimaryKey(['id']);
}
public function down(Schema $schema) : void
{
$schema->dropTable('user');
}
17. Write Your Migration
public function up(Schema $schema) : void
{
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL,
username VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET
utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
}
public function down(Schema $schema) : void
{
$this->addSql('DROP TABLE user');
}
18. $ php bin/console doctrine:migrations:migrate
Application Migrations
WARNING! You are about to execute a database migration that could result in schema
changes and data loss. Are you sure you wish to continue? (y/n)y
Migrating up to 20181012002437 from 0
++ migrating 20181012002437
-> CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT
NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE
= InnoDB
++ migrated (0.04s)
------------------------
++ finished in 0.04s
++ 1 migrations executed
++ 1 sql queries
Run Your Migration
19. $ php bin/console doctrine:migrations:migrate prev
Application Migrations
WARNING! You are about to execute a database migration that could result in schema
changes and data loss. Are you sure you wish to continue? (y/n)y
Migrating down to 0 from 20181012002437
-- reverting 20181012002437
-> DROP TABLE user
-- reverted (0.05s)
------------------------
++ finished in 0.05s
++ 1 migrations executed
++ 1 sql queries
Revert Your Migration
20. $ php bin/console make:controller UsersController
Generate Controller
We need a place to play around so let’s use the MakerBundle to generate a
UsersController
21. AppControllerUsersController
class UsersController extends AbstractController
{
/**
* @Route("/users", name="users")
*/
public function index()
{
return $this->json([
'message' => 'Welcome to your new controller!',
'path' => 'src/Controller/UsersController.php',
]);
}
}
30. $ php bin/console make:entity User
Generating a User Entity
Generate a User entity with property named username that is a string and
has a max length of 255 characters.
Generates the following files/classes:
- src/Entity/User.php (AppEntityUser)
- src/Repository/UserRepository.php (AppRepositoryUserRepository)
33. Inject EntityManager
/**
* @Route("/users/create/{username}", name="users_create")
*/
public function create(EntityManagerInterface $em, Request $request)
{
$user = new User();
$user->setUsername($request->request->get('username'));
$em->persist($user);
$em->flush();
// ...
}
34. persist() and flush()
- persist() - schedules an object to be tracked by Doctrine
- flush() - calculates changes made to objects and commits
the changes to the database with SQL INSERT, UPDATE
and DELETE queries.
35. How does flush() work?
$trackedObjects = getTrackedObjects();
$changesets = [];
foreach ($trackedObjects as $trackedObject)
{
$oldValues = getOldValues($trackedObject);
$newValues = getNewValues($trackedObject);
$changesets[] = calculateChangeset($oldValues, $newValues);
}
commitChangesets($changesets);
37. AppRepositoryUserRepository
class UserRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, User::class);
}
/*
public function findOneBySomeField($value): ?User
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
38. Inject the UserRepository
/**
* @Route("/users", name="users")
*/
public function users(UserRepository $userRepository)
{
$users = $userRepository->findAll();
return $this->json(array_map(function(User $user) {
return [
'username' => $user->getUsername(),
];
}, $users));
}
39. Entity Repository: Magic Methods
$user = $userRepository->findOneByUsername('jwage');
$user = $userRepository->findByFieldName('value');
Magic methods are implemented using __call(). When a method that does
not exist is called, the method name is parsed and a query is generated,
executed, and the results are returned.
43. $ php bin/console make:entity User
Modify Your Entity
Modify your User entity and add a property named twitter that is a string and
has a max length of 255 characters.
44. Modify Your Entity
class User
{
// ...
/**
* @ORMColumn(type="string", length=255, nullable=true)
*/
private $twitter;
// ...
}
45. $ php bin/console make:migration
Generate Migration
Now that we’ve modified our User class and mapped a new twitter property,
when we run make:migration, a migration will be generated with the SQL
necessary to add the twitter column to the user table.
public function up(Schema $schema) : void
{
$this->addSql('ALTER TABLE user ADD twitter VARCHAR(255) DEFAULT
NULL');
}
46. $ php bin/console doctrine:migrations:migrate
Application Migrations
WARNING! You are about to execute a database migration that could result in
schema changes and data loss. Are you sure you wish to continue? (y/n)y
Migrating up to 20181012041720 from 20181012002437
++ migrating 20181012041720
-> ALTER TABLE user ADD twitter VARCHAR(255) DEFAULT NULL
++ migrated (0.07s)
------------------------
++ finished in 0.07s
++ 1 migrations executed
++ 1 sql queries
Run Your Migration
57. When To Use Transactions
When you have a unit of work that needs to be
ALL OR NOTHING. Meaning, if one part of a
larger process fails, all changes made to the
database are rolled back.
58. $connection->beginTransaction();
try {
$connection->executeQuery('UPDATE users SET twitter = :twitter WHERE username = :username', [
'twitter' => 'jwage',
'username' => 'jwage'
]);
// execute other updates
// do something that throws an Exception and both updates will be rolled back
$connection->commit();
} catch (Exception $e) {
$connection->rollBack();
throw $e;
}
Example Transaction
61. DQL: Doctrine Query Language
Query language similar to SQL except in DQL
you think in terms of your mapped entities and
class properties instead of tables and columns.
The DQL language is parsed and transformed
to platform specific SQL queries.
What is it?
63. DQL -> SQL
SELECT u FROM AppEntitiesUser u WHERE u.status = :status
SELECT u0_.id AS id_0, u0_.username AS username_1,
u0_.twitter AS twitter_2 FROM user u0_ WHERE u0_.username =
?
DQL
SQL
64. Writing DQL Manually
$query = $entityManager->createQuery(
'SELECT u FROM AppEntityUser u WHERE u.username = :username'
);
/** @var User[] $users */
$users = $query->execute([
'username' => 'jon',
]);
66. Advanced DQL Examples
SELECT u FROM User u WHERE u.phonenumbers IS EMPTY
SELECT u FROM User u WHERE SIZE(u.phonenumbers) > 1
SELECT u.id FROM User u WHERE :groupId MEMBER OF
u.groups
SELECT u.id FROM User u WHERE EXISTS (SELECT
p.phonenumber FROM Phonenumber p WHERE p.user = u.id)
67. DQL: Data Transfer Objects
class CustomerDTO
{
public function __construct($name, $email, $city, $value = null)
{
// Bind values to the object properties.
}
}
$query = $em->createQuery('SELECT NEW CustomerDTO(c.name, e.email, a.city)
FROM Customer c JOIN c.email e JOIN c.address a');
/** @var CustomerDTO[] $users */
$users = $query->getResult();
68. Native Raw SQL
use DoctrineORMEntityManagerInterface;
$rsm = new ResultSetMapping();
$rsm->addEntityResult(User::class, 'u');
$rsm->addFieldResult('u', 'id', 'id');
$rsm->addFieldResult('u', 'username', 'username');
$rsm->addFieldResult('u', 'twitter', 'twitter');
$query = $em->createNativeQuery(
'SELECT id, username, twitter FROM user WHERE username = :username', $rsm
);
$query->setParameter('username', 'ryan');
/** @var User[] $user */
$users = $query->getResult();