Enviar búsqueda
Cargar
Doctrine MongoDB ODM (PDXPHP)
•
13 recomendaciones
•
2,100 vistas
Kris Wallsmith
Seguir
An introduction to MongoDB and the Doctrine MongoDB ODM.
Leer menos
Leer más
Tecnología
Denunciar
Compartir
Denunciar
Compartir
1 de 49
Descargar ahora
Descargar para leer sin conexión
Recomendados
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
Kris Wallsmith
Advanced symfony Techniques
Advanced symfony Techniques
Kris Wallsmith
The Zen of Lithium
The Zen of Lithium
Nate Abele
News of the Symfony2 World
News of the Symfony2 World
Fabien Potencier
PHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php framework
G Woo
Building Lithium Apps
Building Lithium Apps
Nate Abele
The Origin of Lithium
The Origin of Lithium
Nate Abele
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
Nate Abele
Recomendados
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
Kris Wallsmith
Advanced symfony Techniques
Advanced symfony Techniques
Kris Wallsmith
The Zen of Lithium
The Zen of Lithium
Nate Abele
News of the Symfony2 World
News of the Symfony2 World
Fabien Potencier
PHP 5.3 and Lithium: the most rad php framework
PHP 5.3 and Lithium: the most rad php framework
G Woo
Building Lithium Apps
Building Lithium Apps
Nate Abele
The Origin of Lithium
The Origin of Lithium
Nate Abele
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
Nate Abele
Dependency Injection IPC 201
Dependency Injection IPC 201
Fabien Potencier
Electrify your code with PHP Generators
Electrify your code with PHP Generators
Mark Baker
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
Hugo Hamon
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Nate Abele
Lithium Best
Lithium Best
Richard McIntyre
The State of Lithium
The State of Lithium
Nate Abele
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Fabien Potencier
Nubilus Perl
Nubilus Perl
Flavio Poletti
Silex meets SOAP & REST
Silex meets SOAP & REST
Hugo Hamon
Perl Web Client
Perl Web Client
Flavio Poletti
The History of PHPersistence
The History of PHPersistence
Hugo Hamon
Looping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
Mark Baker
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
Fabien Potencier
Database Design Patterns
Database Design Patterns
Hugo Hamon
SPL: The Missing Link in Development
SPL: The Missing Link in Development
jsmith92
Doctrine fixtures
Doctrine fixtures
Bill Chang
Symfony War Stories
Symfony War Stories
Jakub Zalas
Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12
Jakub Zalas
Speed up your developments with Symfony2
Speed up your developments with Symfony2
Hugo Hamon
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
Leonardo Proietti
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
David Golden
Redis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
Más contenido relacionado
La actualidad más candente
Dependency Injection IPC 201
Dependency Injection IPC 201
Fabien Potencier
Electrify your code with PHP Generators
Electrify your code with PHP Generators
Mark Baker
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
Hugo Hamon
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Nate Abele
Lithium Best
Lithium Best
Richard McIntyre
The State of Lithium
The State of Lithium
Nate Abele
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Fabien Potencier
Nubilus Perl
Nubilus Perl
Flavio Poletti
Silex meets SOAP & REST
Silex meets SOAP & REST
Hugo Hamon
Perl Web Client
Perl Web Client
Flavio Poletti
The History of PHPersistence
The History of PHPersistence
Hugo Hamon
Looping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
Mark Baker
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
Fabien Potencier
Database Design Patterns
Database Design Patterns
Hugo Hamon
SPL: The Missing Link in Development
SPL: The Missing Link in Development
jsmith92
Doctrine fixtures
Doctrine fixtures
Bill Chang
Symfony War Stories
Symfony War Stories
Jakub Zalas
Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12
Jakub Zalas
Speed up your developments with Symfony2
Speed up your developments with Symfony2
Hugo Hamon
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
Leonardo Proietti
La actualidad más candente
(20)
Dependency Injection IPC 201
Dependency Injection IPC 201
Electrify your code with PHP Generators
Electrify your code with PHP Generators
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium Best
Lithium Best
The State of Lithium
The State of Lithium
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Nubilus Perl
Nubilus Perl
Silex meets SOAP & REST
Silex meets SOAP & REST
Perl Web Client
Perl Web Client
The History of PHPersistence
The History of PHPersistence
Looping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
Database Design Patterns
Database Design Patterns
SPL: The Missing Link in Development
SPL: The Missing Link in Development
Doctrine fixtures
Doctrine fixtures
Symfony War Stories
Symfony War Stories
Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12
Speed up your developments with Symfony2
Speed up your developments with Symfony2
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
Similar a Doctrine MongoDB ODM (PDXPHP)
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
David Golden
Redis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
CodeIgniter Class Reference
CodeIgniter Class Reference
Jamshid Hashimi
The Art of Transduction
The Art of Transduction
David Stockton
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
Vic Metcalfe
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7
chuvainc
Crazy things done on PHP
Crazy things done on PHP
Taras Kalapun
Drupal7 dbtng
Drupal7 dbtng
Nicolas Leroy
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
Coding Horrors
Coding Horrors
Mark Baker
Why Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary Thing
Chris Reynolds
Dumping Perl 6 (French Perl Workshop)
Dumping Perl 6 (French Perl Workshop)
brian d foy
DBI
DBI
abrummett
究極のコントローラを目指す
究極のコントローラを目指す
Yasuo Harada
Zf Zend Db by aida
Zf Zend Db by aida
waraiotoko
Dependency Injection
Dependency Injection
Rifat Nabi
Database api
Database api
InternetDevels
Php functions
Php functions
JIGAR MAKHIJA
Dumping Perl 6 (AmsterdamX.pm)
Dumping Perl 6 (AmsterdamX.pm)
brian d foy
PrettyDump Perl 6 (London.pm)
PrettyDump Perl 6 (London.pm)
brian d foy
Similar a Doctrine MongoDB ODM (PDXPHP)
(20)
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
Redis for the Everyday Developer
Redis for the Everyday Developer
CodeIgniter Class Reference
CodeIgniter Class Reference
The Art of Transduction
The Art of Transduction
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7
Crazy things done on PHP
Crazy things done on PHP
Drupal7 dbtng
Drupal7 dbtng
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Coding Horrors
Coding Horrors
Why Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary Thing
Dumping Perl 6 (French Perl Workshop)
Dumping Perl 6 (French Perl Workshop)
DBI
DBI
究極のコントローラを目指す
究極のコントローラを目指す
Zf Zend Db by aida
Zf Zend Db by aida
Dependency Injection
Dependency Injection
Database api
Database api
Php functions
Php functions
Dumping Perl 6 (AmsterdamX.pm)
Dumping Perl 6 (AmsterdamX.pm)
PrettyDump Perl 6 (London.pm)
PrettyDump Perl 6 (London.pm)
Más de Kris Wallsmith
Matters of State
Matters of State
Kris Wallsmith
The View From Inside
The View From Inside
Kris Wallsmith
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
Kris Wallsmith
Drupal, meet Assetic
Drupal, meet Assetic
Kris Wallsmith
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
Kris Wallsmith
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
Assetic (Zendcon)
Assetic (Zendcon)
Kris Wallsmith
Assetic (OSCON)
Assetic (OSCON)
Kris Wallsmith
Assetic (Symfony Live Paris)
Assetic (Symfony Live Paris)
Kris Wallsmith
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
Kris Wallsmith
A Practical Introduction to Symfony2
A Practical Introduction to Symfony2
Kris Wallsmith
Symfony 2
Symfony 2
Kris Wallsmith
Symfony in the Cloud
Symfony in the Cloud
Kris Wallsmith
Más de Kris Wallsmith
(14)
Matters of State
Matters of State
The View From Inside
The View From Inside
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
Drupal, meet Assetic
Drupal, meet Assetic
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
How Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Assetic (Zendcon)
Assetic (Zendcon)
Assetic (OSCON)
Assetic (OSCON)
Assetic (Symfony Live Paris)
Assetic (Symfony Live Paris)
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
A Practical Introduction to Symfony2
A Practical Introduction to Symfony2
Symfony 2
Symfony 2
Symfony in the Cloud
Symfony in the Cloud
Último
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
Raghuram Pandurangan
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
Lonnie McRorey
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Alex Barbosa Coqueiro
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Dilum Bandara
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
Manik S Magar
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
mohitsingh558521
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
Rick Flair
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Mark Simos
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
UiPathCommunity
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
LoriGlavin3
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Curtis Poe
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Addepto
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
LoriGlavin3
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
LoriGlavin3
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
2toLead Limited
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
blackmambaettijean
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
MounikaPolabathina
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
Stephanie Beckett
Último
(20)
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
Doctrine MongoDB ODM (PDXPHP)
1.
Doctrine MongoDB ODM
Kris Wallsmith October 19, 2010
2.
@kriswallsmith •
Symfony Release Manager • Doctrine Team • Senior Software Engineer at • 10 years experience with PHP and web development • Open source evangelist and international speaker
3.
This is MongoDB…
4.
$mongo = new
Mongo(); $db = $mongo->pdxphp; $db->people->save(array( 'name' => 'Kris Wallsmith', ));
5.
$cursor = $db->people->find(); print_r(iterator_to_array($cursor));
6.
Array (
[4cbdffdae84ded424f000000] => Array ( [_id] => MongoId Object [name] => Kris Wallsmith ) )
7.
MongoDB is where
you put your arrays for later.
8.
$db->people->save(array(
'name' => 'Sam Keen', 'roles' => array( 'organizer', 'presenter', ), ));
9.
$query = array('roles'
=> 'presenter'); $cursor = $db->people->find($query); print_r(iterator_to_array($cursor));
10.
Array (
[4cbe03cfe84dedb850010000] => Array ( [_id] => MongoId Object [name] => Sam Keen [roles] => Array ( [0] => organizer [1] => presenter ) ) )
11.
Me too!
12.
$query = array(
'name' => 'Kris Wallsmith', ); $kris = $db->people->findOne($query); $kris['roles'] = array('presenter'); $db->people->save($kris);
13.
$query = array('roles'
=> 'presenter'); $fields = array('name'); $cursor = $db->people->find($query, $fields); print_r(iterator_to_array($cursor));
14.
Array (
[4cbe0a9de84ded7952010000] => Array ( [_id] => MongoId Object [name] => Sam Keen ) [4cbe0a9de84ded7952000000] => Array ( [_id] => MongoId Object [name] => Kris Wallsmith ) )
15.
Be surgical.
16.
$query = array('roles'
=> 'presenter'); $update = array( '$push' => array( 'roles' => 'cool guy', ), ); $db->people->update($query, $update);
17.
Atomic Operators • $inc
• $addToSet • $set • $pop • $unset • $pull • $push • $pullAll • $pushAll • $rename
18.
Advanced Queries
19.
$roles = array('organizer',
'presenter'); $db->people->find(array( 'roles' => array('$all' => $roles), ));
20.
Conditional Operators • $ne
• $size • $in • $exists • $nin • $type • $mod • $or • $all • $elemMatch
21.
Cursor Methods
22.
$cursor = $db->people->find(); $cursor->sort(array('name'
=> 1)); foreach ($cursor as $person) { // ... }
23.
I like you,
Sam.
24.
$samRef = MongoDBRef::create('people',
$samId); $db->people->update( array('_id' => $kris['_id']), array( '$addToSet' => array( 'likes' => $samRef, ), ) );
25.
$sam = $db->getDBRef($samRef);
26.
$db->people->find(array(
'likes.$id' => $kris['_id'], ));
27.
Terminology RDBMS
MongoDB Database Database Table Collection Row Document Foreign Key Database Reference
28.
A document is
an array.
29.
Arrays are nice.
30.
Objects are better.*
* Whenever objects are better.
31.
The Doctrine MongoDB Object
Document Mapper maps documents to and from objects.
32.
We just need
to tell it how.
33.
/** @Document(collection="people") */ class
Person { /** @Id */ public $id; /** @String */ public $name; /** @Collection */ public $roles = array(); /** @ReferenceMany */ public $likes = array(); /** @EmbedMany(targetDocument="Address") */ public $addresses = array(); }
34.
POPO FTW!
35.
$kris = new
Person(); $kris->name = 'Kris Wallsmith'; $kris->roles[] = 'presenter'; $kris->likes[] = $sam; $kris->addresses[] = $homeAddy; $documentManager->persist($kris); $documentManager->flush();
36.
Wherefore art thou
->save() ?
37.
Documents Controller
Document Manager
38.
39.
ActiveRecord is more
abstract.
40.
Doctrine calculates the optimal
query for you.
41.
$kris = $dm->findOne('Person',
array( 'name' => 'Kris Wallsmith', )); $kris->roles[] = 'cool guy'; $dm->flush();
42.
$db->people->update(array(
'_id' => $kris->id, ), array( '$push' => array( 'roles' => 'cool guy', ), ));
43.
Query API
44.
$query = $dm->createQuery('Person')
->field('name')->notEqual('Kris Wallsmith') ->field('roles')->equals('presenter') ->sort('name', 'asc'); $cursor = $query->execute();
45.
Lifecycle Callbacks
46.
/** @Document @HasLifecycleCallbacks
*/ class Foo { /** @Timestamp */ public $createdAt; /** @PrePersist */ public function ensureCreatedAt() { $this->createdAt = new DateTime(); } }
47.
OpenSky is Hiring!
http://engineering.shopopensky.com Please contact me if you're interested.
48.
OpenSky is Hiring!
http://engineering.shopopensky.com Please contact me if you're interested.
49.
mongodb.org doctrine-project.org symfony-reloaded.org
Descargar ahora