SlideShare ist ein Scribd-Unternehmen logo
1 von 92
Downloaden Sie, um offline zu lesen
Saturday, June 16, 2012
Saturday, June 16, 2012
¿Quién soy?


     ⁃ Argentino viviendo en Estados Unidos desde 1999
     ⁃ Desarrollador PHP & Symfony
     ⁃ Fundador de la primera lista de discusión de PHP de
         habla hispana
     - Socio fundador de ServerGrove
     ⁃ Maestro de la parrilla




Saturday, June 16, 2012
Saturday, June 16, 2012
Saturday, June 16, 2012
ServerGrove!

      ⁃ Fundada en 2005

      ⁃ Proveedor de servicios de hosting especializado en PHP,
        Symfony, ZendFramework, y otros

      ⁃ Servidores en Europa y Estados Unidos

      ⁃ Mongohosting.com en beta!




Saturday, June 16, 2012
La comunidad es nuestra guia
            ⁃ Muy activos en la comunidad de Open Source
              contribuyendo con código o patrocinando eventos y
              grupos de usuarios




Saturday, June 16, 2012
Agenda




     - Introducción a MongoDB
     - PHP y MongoDB
     - Librerías en PHP
     - Symfony2 y MongoDB




Saturday, June 16, 2012
¿Qué es MongoDB?




                          ¿Quién es 10Gen?




Saturday, June 16, 2012
Mongo
                      Mongo viene de "humongous". Usado para
                      describir algo extremadamente grande o
                      importante



Saturday, June 16, 2012
MongoDB es una base de datos NoSQL,
               escalable, de alta performance
                    y de código abierto.

    - BD orientada a documentos
    - Escrita en C++
    - Disponible en *nux (Linux, Solaris, etc),
       Windows y OS X
    - Muchos drivers (PHP, Java, Python, Ruby...)




Saturday, June 16, 2012
Descripción

         - Documentos flexibles tipo JSON
         - Soporte completo de Indices
         - Queries complejos / Map Reduce
         - Framework de agregación (próximamente)
         - GridFS (almacena archivos nativamente)
         - Múltiples opciones de replicación
         - Sharding
         - Instalación sencilla con cero configuración




Saturday, June 16, 2012
Orientada a Objetos


     ¿Vienes de SQL?




                                  Base de datos => Base de datos
                                  Tabla => Colección
                                  Fila => Documento




Saturday, June 16, 2012
Documentos Tipo JSON

    {
         nombre: {
                   primero: 'Juan',
                   apellido: 'Perez'
                  },
         titulo: 'Ingeniero',
         edad: 40
  }




Saturday, June 16, 2012
Sin Schema o Tablas Fijas

    {
         nombre: {
                   primero: 'Juan',
                   apellido: 'Perez'
                  },
         titulo: 'Ingeniero',
         edad: 40,
         escuela: 'UJI'
  }


Saturday, June 16, 2012
Documentos Embebidos
   {
    "_id" : ObjectId("4ccba15ef597e9352e060000")
    "srcFilename" : "/etc/apache2/sites-enabled/example1.com",
    "vhostDirective" :
          { "directives" : [
                       {
                           "name" : "CustomLog",
                           "value" : "logs/example1.com-access_log combined"
                         },
                       {
                          "name" : "DocumentRoot",
                          "value" : "/var/www/vhosts/example1.com/httpdocs"
                       },
                       {
                          "name" : "ServerName",
                          "value" : "example1.com"
                       }
                     ]
           }
   }




Saturday, June 16, 2012
Referencias Entre Documentos
    {
    "_id" : ObjectId("4cc4a5c3f597e9db6e010109"),
    "billingId" : NumberLong(650),
    "created" : ISODate("2010-10-24T21:31:47Z"),
    "servers" : [
       {
         "$ref" : "server",
         "$id" : ObjectId("4cc4a5c4f597e9db6e050201")
       }
    ],
    "users" : [
       {
         "$ref" : "user",
         "$id" : ObjectId("4cc4a5c4f597e9db6e980201")
       },
       {
         "$ref" : "user",
         "$id" : ObjectId("4cc4a5c4f597e9db6e9c0201")
       }
    ]
    }



Saturday, June 16, 2012
Indices



    db.personal.ensureIndex({nombre: 1})

    db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1})

    db. personal.ensureIndex({edad: 0})




Saturday, June 16, 2012
Indices



    db.personal.ensureIndex({nombre: 1})

    db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1})

    db. personal.ensureIndex({edad: 0})




Saturday, June 16, 2012
Indices



    db.personal.ensureIndex({nombre: 1})

    db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1})

    db. personal.ensureIndex({edad: 0})




Saturday, June 16, 2012
Consultas



                   db. personal.find({nombre: 'Juan'})

                   db. personal.find({tags: 'symfony'})

                   db. personal.find({tags: {$in: ['symfony', 'PHP']}}




Saturday, June 16, 2012
Consultas



                   db. personal.find({nombre: 'Juan'})

                   db. personal.find({tags: 'symfony'})

                   db. personal.find({tags: {$in: ['symfony', 'PHP']}}




Saturday, June 16, 2012
Consultas



                   db. personal.find({nombre: 'Juan'})

                   db. personal.find({tags: 'symfony'})

                   db. personal.find({tags: {$in: ['symfony', 'PHP']}}




Saturday, June 16, 2012
GridFS




               - Archivos son divididos en “chunks” o partes y son
               guardados en múltiples documentos

               - API transparente




Saturday, June 16, 2012
Replicación




                          Source: http://www.mongodb.org/display/DOCS/Replication




Saturday, June 16, 2012
Shards




                          Source: http://www.mongodb.org/display/DOCS/Introduction




Saturday, June 16, 2012
Simple instalación con cero configuración


                                 OS X


        wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.4.tgz

        tar zxvf mongodb-osx-x86_64-2.0.4.tgz

        cd mongodb-osx-x86_64-2.0.4

        ./mongod




Saturday, June 16, 2012
Simple instalación con cero configuración

                                   CentOS Linux
  /etc/yum.repos.d/10gen.repo

  [10gen]
  name=10gen Repository
  baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
  gpgcheck=0



  $ yum install -y mongo-stable-server
  $ service mongod start




Saturday, June 16, 2012
Backups
                          mongodump
                          mongodump -u usuario -p pass


                          mongorestore
                          mongorestore -u usuario -p pass




                          mongoexport
                          mongoexport -u usuario -p pass


                          mongoimport
                          mongoimport -u usuario -p pass




Saturday, June 16, 2012
Monitoreo
      mongostat




Saturday, June 16, 2012
Monitoreo
http://localhost:28017/




Saturday, June 16, 2012
¿Por qué MongoDB es bueno
                           para el desarrollo rápido de
                                aplicacones web?




Saturday, June 16, 2012
Desarrollo Rápido de Aplicaciones

                          Sin schema / orientada a documentos
                                                       FLEXIBLE




     by exfordy




Saturday, June 16, 2012
Desarrollo Rápido de Aplicaciones

                          Sin schema / orientada a documentos

                                                     MIGRACIONES
                                                     MAS FACILES




     by exfordy




Saturday, June 16, 2012
Desarrollo Rápido de Aplicaciones

                                             NO HAY JOINS!




Saturday, June 16, 2012
Rendimiento

                                        VELOZ




       by xavi talleda




Saturday, June 16, 2012
Rendimiento

                                                  ESCALABILIDAD




     by Jimee, Jackie, Tom & Asha




Saturday, June 16, 2012
Ojo al piojo!



                                     - No hay transacciones
                                     - No hay rollbacks
                                     - Valores inseguros
                                       por defecto
                                     - Locks en Map Reduce




      by Ernst Vikne




Saturday, June 16, 2012
Buenas aplicaciones

                          - Sistema de manejo de contenidos (CMS)

                          - Catálogos de productos

                          - Análisis en tiempo real

                          - Almacenamiento de logs




Saturday, June 16, 2012
y




Saturday, June 16, 2012
Driver de PECL

 Linux
 pecl install mongo
 echo “extension=mongo.so >> /path/php.ini”



 OS X
 http://php-osx.liip.ch/


 Windows
 https://github.com/mongodb/mongo-php-driver/downloads



Saturday, June 16, 2012
Uso
 <?php
 // conectar
 $m = new Mongo();
 // seleccionar una base de datos
 $db = $m->biblioteca;
 // seleccionar una coleccón
 $collection = $db->libros;
 // agregar un documento
 $obj = array( "titulo" => "RabbitMQ in Action", "autor" => "Alvaro
 Videla" );
 $collection->insert($obj);
 // agregar otro documento con distintos datos
 $obj = array( "titulo" => "Desarrollo en Symfony", "pdf" => true );
 $collection->insert($obj);
 // obtener todos los documentos en la colección
 $cursor = $collection->find();
 // iterar los resultados
 foreach ($cursor as $obj) {
     echo $obj["titulo"] . "n";
 }
 ?>


Saturday, June 16, 2012
Almacenamiento de Archivos
          <?php

          // guardar un archivo
          $id = $grid->storeFile("libro.pdf");
          $libro = $grid->findOne();

          // agregar un contador de descargas
          $libro->file['descargas'] = 0;
          $grid->save($libro->file);

          // incrementar el contador
          $grid->update(array("_id" => $id), array('$inc' => array
          ("descargas" => 1)));

          ?>




Saturday, June 16, 2012
Queries de SQL a Mongo




                http://php.net/manual/es/mongo.sqltomongo.php

Saturday, June 16, 2012
Interfaces de Administración
         - Genghis




           http://genghisapp.com/


Saturday, June 16, 2012
Interfaces de Administración
      - RockMongo




           http://code.google.com/p/rock-php/wiki/rock_mongo
Saturday, June 16, 2012
Interfaces de Administración

         - php-mongodb-admin




          https://github.com/jwage/php-mongodb-admin



Saturday, June 16, 2012
Interfaces de Administración
     - mongohosting.com




          https://github.com/jwage/php-mongodb-admin



Saturday, June 16, 2012
Librerias en PHP




                          - Doctrine ODM




Saturday, June 16, 2012
Librerias en PHP




                          - Doctrine ODM

                          - Mandango




Saturday, June 16, 2012
Librerias en PHP




                          - Doctrine ODM

                          - Mandango

                          - varias más...




Saturday, June 16, 2012
Doctrine MongoDB ODM



                          http://doctrine-project.org

     Doctrine MongoDB Object Document Mapper
      (ODM) está desarrollado para PHP 5.3.2+ y
    provee persistencia transparente de objetos PHP.



Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM
        Tipos de Mappings

                          bin_data_custom   float
                          bin_data_func     hash
                          bin_data_md5      id
                          bin_data          int
                          bin_data_uuid     key
                          boolean           string
                          date              timestamp
                          file               increment




Saturday, June 16, 2012
Doctrine MongoDB ODM


                          Campos “AutoIncrement”
                          <?php
                          /** Document */
                          class MiClase
                          {
                              /** @Id(strategy="INCREMENT") */
                              private $id;
                              public function getId()
                              {
                                  return $this->id;
                              }
                              //...
                          }




Saturday, June 16, 2012
Doctrine MongoDB ODM
 Tipos propios
  <?php

  namespace MyProjectTypes;

  use DoctrineDBALTypesType;
  use DoctrineDBALPlatformsAbstractPlatform;

  /**
    * My custom datatype.
    */
  class MyType extends Type
  {
       public function convertToPHPValue($value)
       {
           // This is executed when the value is read from the database. Make your
  conversions here.
       }

      public function convertToDatabaseValue($value)
      {
          // This is executed when the value is written to the database. Make your
  conversions here.
      }
  }




Saturday, June 16, 2012
Doctrine MongoDB ODM
 Múltiples tipos en una misma colección
  /**
    * @Document(collection="documentos")
    * @DiscriminatorField(fieldName="type")
    * @DiscriminatorMap({"article"="Articulo", "album"="Album"})
    */
  class Articulo
  {
       // ...
  }

  /**
    * @Document(collection="documentos")
    * @DiscriminatorField(fieldName="type")
    * @DiscriminatorMap({"article"="Articulo", "album"="Album"})
    */
  class Album
  {
       // ...
  }



Saturday, June 16, 2012
Doctrine MongoDB ODM
  /** @Document */
  class Usuario
  {
      /** @Id */
      private $id;

            /** @String */
            private $nombre;

            /** @String */
            private $email;

            /** @ReferenceMany(targetDocument="Articulo", cascade="all") */
            private $articulos = array();

            // ...
  }




Saturday, June 16, 2012
Doctrine MongoDB ODM
  /** @Document */
  class Articulo
  {
      /** @Id */
      private $id;

            /** @String */
            private $titulo;

            /** @String */
            private $contenido;

            /** @Date */
            private $createdAt;

            // ...
  }




Saturday, June 16, 2012
Doctrine MongoDB ODM
  <?php

  // crear un usuario
  $user = new Usuario();
  $user->setNombre('Juan P.');
  $user->setEmail('email@example.com');

  // avisale a Doctrine2 que guarde $usuario en el próximo flush()
  $dm->persist($usuario);

  // crear un articulo
  $articulo = new Articulo();
  $articulo->setTitulo('Mi primer articulo');
  $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!');
  $articulo->setCreatedAt(new DateTime());

  $user->agregarArticulo($articulo);

  // guarda todo en MongoDB
  $dm->flush();




Saturday, June 16, 2012
Doctrine MongoDB ODM
  <?php

  // crear un usuario
  $usuario = new Usuario();
  $usuario->setNombre('Juan P.');
  $usuario->setEmail('email@example.com');

  // avisale a Doctrine2 que guarde $usuario en el próximo flush()
  $dm->persist($usuario);

  // crear un articulo
  $articulo = new Articulo();
  $articulo->setTitulo('Mi primer articulo');
  $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!');
  $articulo->setCreatedAt(new DateTime());

  $user->addArticulo($articulo);

  // guarda todo en MongoDB
  $dm->flush($usuario);




Saturday, June 16, 2012
Doctrine MongoDB ODM
  <?php

  // crear un usuario
  $user = new Usuario();
  $user->setNombre('Juan P.');
  $user->setEmail('email@example.com');

  // avisale a Doctrine2 que guarde $usuario en el próximo flush()
  $dm->persist($usuario);

  // crear un articulo
  $articulo = new Articulo();
  $articulo->setTitulo('Mi primer articulo');
  $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!');
  $articulo->setCreatedAt(new DateTime());

  $user->agregarArticulo($articulo);

  // guarda todo en MongoDB
  $dm->flush($usuario, false);




Saturday, June 16, 2012
Doctrine MongoDB ODM

  Array
  (
      [_id] => 4bec5869fdc212081d000000
      [titulo] => My First Blog Post
      [contenido] => MongoDB + Doctrine 2 ODM = awesomeness!
      [createdAt] => MongoDate Object
          (
              [sec] => 1273723200
              [usec] => 0
          )
  )




Saturday, June 16, 2012
Doctrine MongoDB ODM
  Array
  (
      [_id] => 4bec5869fdc212081d010000
      [nombre] => Bulat S.
      [email] => email@example.com
      [articulos] => Array
          (
              [0] => Array
                  (
                      [$ref] => Articulo
                      [$id] => 4bec5869fdc212081d000000
                      [$db] => test_database
                  )
          )
  )




Saturday, June 16, 2012
Doctrine MongoDB ODM

  $usuario = $dm->find('Usuario', $idDelUsuario);

  $usuario = $dm->getRepository('Usuario')->findOneByNombre('Juan');

  $articulos = $usuario->getArticulos();
  foreach ($articulos as $articulo) {
     echo $articulo;
  }




Saturday, June 16, 2012
Doctrine MongoDB ODM
  Repositorios de documents
  // src/TuNamespace/TuBundle/ServerRepository.php
  namespace TuNamespaceTuBundle;

  use DoctrineODMMongoDBDocumentRepository;

  class ServerRepository extends DocumentRepository
  {
      public function getActiveServers()
      {
          return $this->createQueryBuilder()
                  ->field('isActive')->equals(true)
                  ->sort('name', 'asc')->getQuery()->execute();
      }



  Usage
  $rep = $dm->getRepository(‘@TuBundle/Server’);
  $servers = $rep->getActiveServers();


Saturday, June 16, 2012
Doctrine MongoDB ODM
  /** @Document */
  class Imagen
  {
      /** @Id */
      private $id;

            /** @Field */
            private $nombre;

            /** @File */
            private $file;




Saturday, June 16, 2012
Doctrine MongoDB ODM
  // guardar archivo
  $imagen = new Imagen();
  $imagen->setNombre('Imagen de prueba');
  $imagen->setFile('/path/to/imagen.png');

  $dm->persist($imagen);
  $dm->flush();


  // obtener documento y enviar archivo al cliente HTTP
  $imagen = $dm->createQueryBuilder('DocumentsImagen')
      ->field('nombre')->equals('Imagen de prueba')
      ->getQuery()
      ->getSingleResult();

  header('Content-type: image/png;');
  echo $imagen->getFile()->getBytes();




Saturday, June 16, 2012
Saturday, June 16, 2012
¡No necesita introducción!



Saturday, June 16, 2012
Bundles de Symfony2


                          - DoctrineMongoDBBundle




Saturday, June 16, 2012
Bundles de Symfony2


                          - DoctrineMongoDBBundle


                          - MandangoBundle




Saturday, June 16, 2012
DoctrineMongoDBBundle

            Instalación en Symfony 2.0
            deps
            [doctrine-mongodb]
                git=http://github.com/doctrine/mongodb.git

            [doctrine-mongodb-odm]
                git=http://github.com/doctrine/mongodb-odm.git

            [DoctrineMongoDBBundle]
                git=http://github.com/doctrine/DoctrineMongoDBBundle.git
                target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
                version=v2.0.0


            $ ./bin/vendors install




Saturday, June 16, 2012
DoctrineMongoDBBundle

                Instalación en Symfony 2.1 con Composer

                composer.json
                {
                          require: {
                              "doctrine/mongodb-odm-bundle": "dev-master"
                          }
                }




                 $ php composer.phar update




Saturday, June 16, 2012
DoctrineMongoDBBundle
  Configurando Symfony2.1


  app/autoload.php
 use DoctrineCommonAnnotationsAnnotationRegistry;

 AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/
 mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/
 DoctrineAnnotations.php');




Saturday, June 16, 2012
DoctrineMongoDBBundle
  Configurando Symfony2.1

 app/config/config.yml
 doctrine_mongodb:
     connections:
         default:
             server: mongodb://localhost:27017
             options:
                  connect: true
     default_database: test_database
     document_managers:
         default:
             auto_mapping: true




Saturday, June 16, 2012
DoctrineMongoDBBundle
  app/config/config.yml
 doctrine_mongodb:
     connections:
         default:
             server: mongodb://localhost:27017
             options:
                  connect: true

         usage:
             server: mongodb://user:pass@db1.mongohosting.com:27017
             options:
                  replicaSet: true
                  connect: true
     default_database: test_database
     document_managers:
         default:
             mappings:
                SGCBundle: ~
                SGCRepositoryAppBundle: yml
                MiBundle: { type: xml, dir: Resources/config/doctrine/
 mapping }


Saturday, June 16, 2012
DoctrineMongoDBBundle
                    Definiendo
                    Documentos




Saturday, June 16, 2012
DoctrineMongoDBBundle
 Definiendo Documentos
 // src/Acme/StoreBundle/Document/Product.php
 namespace AcmeStoreBundleDocument;

 use DoctrineODMMongoDBMappingAnnotations as MongoDB;

 /**
   * @MongoDBDocument(collection="product")
   */
 class Product
 {
      /**
       * @MongoDBId
       */
      protected $id;

           /**
            * @MongoDBString @MongoDBIndex(unique=true, order="asc")
            */
           protected $name;



Saturday, June 16, 2012
DoctrineMongoDBBundle
 Usando Documentos
 // src/Acme/StoreBundle/Controller/DefaultController.php
 use AcmeStoreBundleDocumentProduct;
 use SymfonyComponentHttpFoundationResponse;
 // ...

 public function createAction()
 {
     $product = new Product();
     $product->setName('A Foo Bar');
     $product->setPrice('19.99');

           $dm = $this->get('doctrine.odm.mongodb.document_manager');
           $dm->persist($product);
           $dm->flush();

           return new Response('Created product id '.$product->getId());
 }




Saturday, June 16, 2012
DoctrineMongoDBBundle
 Consumiendo Mongo directamente
 // src/Acme/StoreBundle/Controller/DefaultController.php
 use SymfonyComponentHttpFoundationResponse;
 // ...

 public function createAction()
 {
     $dm = $this->get('doctrine.odm.mongodb.document_manager');
     $mongo = $dm->getConnection()->getMongo());
     $resultado = $mongo->miBD->miColleccion->find();

           ...




Saturday, June 16, 2012
Formularios
   Debido a que los documentos son objetos simples de PHP, integrar los formularios es
   extremadamente sencillo.

public function createAction()
{
    $dm = $this->get('doctrine.odm.mongodb.default_document_manager');

         $form = $this->createForm(new RegistrationType(),
                                   new Registration());

         $form->bindRequest($this->getRequest());

         if ($form->isValid()) {
             $registration = $form->getData();

                   $dm->persist($registration->getUser());
                   $dm->flush();

                   return $this->redirect(...);
         }

                     http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/form.html




Saturday, June 16, 2012
Comandos

  Comandos de Symfony2
 doctrine
   doctrine:mongodb:cache:clear-metadata    Clear all metadata cache for a document manager.
   doctrine:mongodb:fixtures:load           Load data fixtures to your database.
   doctrine:mongodb:generate:documents      Generate document classes and method stubs from
 your mapping information.
   doctrine:mongodb:generate:hydrators      Generates hydrator classes for document classes.
   doctrine:mongodb:generate:proxies        Generates proxy classes for document classes.
   doctrine:mongodb:generate:repositories   Generate repository classes from your mapping
 information.
   doctrine:mongodb:mapping:info            Show basic information about all mapped
 documents.
   doctrine:mongodb:query                   Query mongodb and inspect the outputted results
 from your document classes.
   doctrine:mongodb:schema:create           Allows you to create databases, collections and
 indexes for your documents
   doctrine:mongodb:schema:drop             Allows you to drop databases, collections and
 indexes for your documents




Saturday, June 16, 2012
Bundles que usan MongoDB


                - SonataDoctrineMongoDBAdminBundle

                - IsmaAmbrosiGeneratorBundle

                - EbutikMongoSessionBundle

                - TranslationEditorBundle

                - ServerGroveLiveChat



Saturday, June 16, 2012
¿Preguntas?




Saturday, June 16, 2012
¡Muchas Gracias!




                          Transparencias: http://slideshare.net/pgodel
                                      Twitter: @pgodel

Saturday, June 16, 2012

Weitere ähnliche Inhalte

Ähnlich wie Symfony2 y MongoDB - deSymfony 2012

Presentation mongodb public sector dbsig malaysia
Presentation mongodb public sector dbsig malaysiaPresentation mongodb public sector dbsig malaysia
Presentation mongodb public sector dbsig malaysiaSyahman Mohamad
 
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012Treasure Data, Inc.
 
Meetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMeetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMinsk MongoDB User Group
 
Building a MongoDB App with Perl
Building a MongoDB App with PerlBuilding a MongoDB App with Perl
Building a MongoDB App with PerlMike Friedman
 
Enyo for JS Nerds - Austin JS Meetup, April 2012
Enyo for JS Nerds - Austin JS Meetup, April 2012Enyo for JS Nerds - Austin JS Meetup, April 2012
Enyo for JS Nerds - Austin JS Meetup, April 2012Ben Combee
 
ORCID Outreach Meeting dev breakout session
ORCID Outreach Meeting dev breakout sessionORCID Outreach Meeting dev breakout session
ORCID Outreach Meeting dev breakout sessionGudmundur Thorisson
 
Yii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerYii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerMayflower GmbH
 
Yii Next Level
Yii Next LevelYii Next Level
Yii Next LevelAdamPSB
 
Fluentd: the missing log collector
Fluentd: the missing log collectorFluentd: the missing log collector
Fluentd: the missing log collectortd_kiyoto
 
Building Your First Application with MongoDB
Building Your First Application with MongoDBBuilding Your First Application with MongoDB
Building Your First Application with MongoDBMongoDB
 
Who Pulls the Strings?
Who Pulls the Strings?Who Pulls the Strings?
Who Pulls the Strings?Ronny Trommer
 
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...Swiss Big Data User Group
 
Developing RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBDeveloping RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBNicola Iarocci
 
Building real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.jsBuilding real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.jsbetabeers
 
The elephant in the room mongo db + hadoop
The elephant in the room  mongo db + hadoopThe elephant in the room  mongo db + hadoop
The elephant in the room mongo db + hadoopiammutex
 
Multilingual solutions florian loretan
Multilingual solutions florian loretanMultilingual solutions florian loretan
Multilingual solutions florian loretandrupalconf
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JSHamdi Hmidi
 

Ähnlich wie Symfony2 y MongoDB - deSymfony 2012 (20)

Presentation mongodb public sector dbsig malaysia
Presentation mongodb public sector dbsig malaysiaPresentation mongodb public sector dbsig malaysia
Presentation mongodb public sector dbsig malaysia
 
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
Fluentd loves MongoDB, at MongoDB SV User Group, July 17, 2012
 
Meetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMeetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDB
 
Building a MongoDB App with Perl
Building a MongoDB App with PerlBuilding a MongoDB App with Perl
Building a MongoDB App with Perl
 
Enyo for JS Nerds - Austin JS Meetup, April 2012
Enyo for JS Nerds - Austin JS Meetup, April 2012Enyo for JS Nerds - Austin JS Meetup, April 2012
Enyo for JS Nerds - Austin JS Meetup, April 2012
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
ORCID Outreach Meeting dev breakout session
ORCID Outreach Meeting dev breakout sessionORCID Outreach Meeting dev breakout session
ORCID Outreach Meeting dev breakout session
 
Yii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerYii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian Facker
 
Yii Next Level
Yii Next LevelYii Next Level
Yii Next Level
 
Fluentd: the missing log collector
Fluentd: the missing log collectorFluentd: the missing log collector
Fluentd: the missing log collector
 
Building Your First Application with MongoDB
Building Your First Application with MongoDBBuilding Your First Application with MongoDB
Building Your First Application with MongoDB
 
Couch db skillsmatter-prognosql
Couch db skillsmatter-prognosqlCouch db skillsmatter-prognosql
Couch db skillsmatter-prognosql
 
Mongo db operations_v2
Mongo db operations_v2Mongo db operations_v2
Mongo db operations_v2
 
Who Pulls the Strings?
Who Pulls the Strings?Who Pulls the Strings?
Who Pulls the Strings?
 
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...
Large Scale Log Analysis with HBase and Solr at Amadeus (Martin Alig, ETH Zur...
 
Developing RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBDeveloping RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDB
 
Building real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.jsBuilding real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.js
 
The elephant in the room mongo db + hadoop
The elephant in the room  mongo db + hadoopThe elephant in the room  mongo db + hadoop
The elephant in the room mongo db + hadoop
 
Multilingual solutions florian loretan
Multilingual solutions florian loretanMultilingual solutions florian loretan
Multilingual solutions florian loretan
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JS
 

Mehr von Pablo Godel

SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkyPablo Godel
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkyPablo Godel
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyPablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARPablo Godel
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony AppsPablo Godel
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...Pablo Godel
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPablo Godel
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsPablo Godel
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersPablo Godel
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...Pablo Godel
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Pablo Godel
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyPablo Godel
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
 
Soflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developersSoflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developersPablo Godel
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013 Pablo Godel
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsPablo Godel
 

Mehr von Pablo Godel (20)

SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSky
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSky
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSky
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and Symfony
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Soflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developersSoflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developers
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Symfony2 y MongoDB - deSymfony 2012

  • 3. ¿Quién soy? ⁃ Argentino viviendo en Estados Unidos desde 1999 ⁃ Desarrollador PHP & Symfony ⁃ Fundador de la primera lista de discusión de PHP de habla hispana - Socio fundador de ServerGrove ⁃ Maestro de la parrilla Saturday, June 16, 2012
  • 6. ServerGrove! ⁃ Fundada en 2005 ⁃ Proveedor de servicios de hosting especializado en PHP, Symfony, ZendFramework, y otros ⁃ Servidores en Europa y Estados Unidos ⁃ Mongohosting.com en beta! Saturday, June 16, 2012
  • 7. La comunidad es nuestra guia ⁃ Muy activos en la comunidad de Open Source contribuyendo con código o patrocinando eventos y grupos de usuarios Saturday, June 16, 2012
  • 8. Agenda - Introducción a MongoDB - PHP y MongoDB - Librerías en PHP - Symfony2 y MongoDB Saturday, June 16, 2012
  • 9. ¿Qué es MongoDB? ¿Quién es 10Gen? Saturday, June 16, 2012
  • 10. Mongo Mongo viene de "humongous". Usado para describir algo extremadamente grande o importante Saturday, June 16, 2012
  • 11. MongoDB es una base de datos NoSQL, escalable, de alta performance y de código abierto. - BD orientada a documentos - Escrita en C++ - Disponible en *nux (Linux, Solaris, etc), Windows y OS X - Muchos drivers (PHP, Java, Python, Ruby...) Saturday, June 16, 2012
  • 12. Descripción - Documentos flexibles tipo JSON - Soporte completo de Indices - Queries complejos / Map Reduce - Framework de agregación (próximamente) - GridFS (almacena archivos nativamente) - Múltiples opciones de replicación - Sharding - Instalación sencilla con cero configuración Saturday, June 16, 2012
  • 13. Orientada a Objetos ¿Vienes de SQL? Base de datos => Base de datos Tabla => Colección Fila => Documento Saturday, June 16, 2012
  • 14. Documentos Tipo JSON { nombre: { primero: 'Juan', apellido: 'Perez' }, titulo: 'Ingeniero', edad: 40 } Saturday, June 16, 2012
  • 15. Sin Schema o Tablas Fijas { nombre: { primero: 'Juan', apellido: 'Perez' }, titulo: 'Ingeniero', edad: 40, escuela: 'UJI' } Saturday, June 16, 2012
  • 16. Documentos Embebidos { "_id" : ObjectId("4ccba15ef597e9352e060000") "srcFilename" : "/etc/apache2/sites-enabled/example1.com", "vhostDirective" : { "directives" : [ { "name" : "CustomLog", "value" : "logs/example1.com-access_log combined" }, { "name" : "DocumentRoot", "value" : "/var/www/vhosts/example1.com/httpdocs" }, { "name" : "ServerName", "value" : "example1.com" } ] } } Saturday, June 16, 2012
  • 17. Referencias Entre Documentos { "_id" : ObjectId("4cc4a5c3f597e9db6e010109"), "billingId" : NumberLong(650), "created" : ISODate("2010-10-24T21:31:47Z"), "servers" : [ { "$ref" : "server", "$id" : ObjectId("4cc4a5c4f597e9db6e050201") } ], "users" : [ { "$ref" : "user", "$id" : ObjectId("4cc4a5c4f597e9db6e980201") }, { "$ref" : "user", "$id" : ObjectId("4cc4a5c4f597e9db6e9c0201") } ] } Saturday, June 16, 2012
  • 18. Indices db.personal.ensureIndex({nombre: 1}) db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1}) db. personal.ensureIndex({edad: 0}) Saturday, June 16, 2012
  • 19. Indices db.personal.ensureIndex({nombre: 1}) db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1}) db. personal.ensureIndex({edad: 0}) Saturday, June 16, 2012
  • 20. Indices db.personal.ensureIndex({nombre: 1}) db. personal.ensureIndex({nombre.primer: 1, nombre.apellido: 1}) db. personal.ensureIndex({edad: 0}) Saturday, June 16, 2012
  • 21. Consultas db. personal.find({nombre: 'Juan'}) db. personal.find({tags: 'symfony'}) db. personal.find({tags: {$in: ['symfony', 'PHP']}} Saturday, June 16, 2012
  • 22. Consultas db. personal.find({nombre: 'Juan'}) db. personal.find({tags: 'symfony'}) db. personal.find({tags: {$in: ['symfony', 'PHP']}} Saturday, June 16, 2012
  • 23. Consultas db. personal.find({nombre: 'Juan'}) db. personal.find({tags: 'symfony'}) db. personal.find({tags: {$in: ['symfony', 'PHP']}} Saturday, June 16, 2012
  • 24. GridFS - Archivos son divididos en “chunks” o partes y son guardados en múltiples documentos - API transparente Saturday, June 16, 2012
  • 25. Replicación Source: http://www.mongodb.org/display/DOCS/Replication Saturday, June 16, 2012
  • 26. Shards Source: http://www.mongodb.org/display/DOCS/Introduction Saturday, June 16, 2012
  • 27. Simple instalación con cero configuración OS X wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.4.tgz tar zxvf mongodb-osx-x86_64-2.0.4.tgz cd mongodb-osx-x86_64-2.0.4 ./mongod Saturday, June 16, 2012
  • 28. Simple instalación con cero configuración CentOS Linux /etc/yum.repos.d/10gen.repo [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 $ yum install -y mongo-stable-server $ service mongod start Saturday, June 16, 2012
  • 29. Backups mongodump mongodump -u usuario -p pass mongorestore mongorestore -u usuario -p pass mongoexport mongoexport -u usuario -p pass mongoimport mongoimport -u usuario -p pass Saturday, June 16, 2012
  • 30. Monitoreo mongostat Saturday, June 16, 2012
  • 32. ¿Por qué MongoDB es bueno para el desarrollo rápido de aplicacones web? Saturday, June 16, 2012
  • 33. Desarrollo Rápido de Aplicaciones Sin schema / orientada a documentos FLEXIBLE by exfordy Saturday, June 16, 2012
  • 34. Desarrollo Rápido de Aplicaciones Sin schema / orientada a documentos MIGRACIONES MAS FACILES by exfordy Saturday, June 16, 2012
  • 35. Desarrollo Rápido de Aplicaciones NO HAY JOINS! Saturday, June 16, 2012
  • 36. Rendimiento VELOZ by xavi talleda Saturday, June 16, 2012
  • 37. Rendimiento ESCALABILIDAD by Jimee, Jackie, Tom & Asha Saturday, June 16, 2012
  • 38. Ojo al piojo! - No hay transacciones - No hay rollbacks - Valores inseguros por defecto - Locks en Map Reduce by Ernst Vikne Saturday, June 16, 2012
  • 39. Buenas aplicaciones - Sistema de manejo de contenidos (CMS) - Catálogos de productos - Análisis en tiempo real - Almacenamiento de logs Saturday, June 16, 2012
  • 41. Driver de PECL Linux pecl install mongo echo “extension=mongo.so >> /path/php.ini” OS X http://php-osx.liip.ch/ Windows https://github.com/mongodb/mongo-php-driver/downloads Saturday, June 16, 2012
  • 42. Uso <?php // conectar $m = new Mongo(); // seleccionar una base de datos $db = $m->biblioteca; // seleccionar una coleccón $collection = $db->libros; // agregar un documento $obj = array( "titulo" => "RabbitMQ in Action", "autor" => "Alvaro Videla" ); $collection->insert($obj); // agregar otro documento con distintos datos $obj = array( "titulo" => "Desarrollo en Symfony", "pdf" => true ); $collection->insert($obj); // obtener todos los documentos en la colección $cursor = $collection->find(); // iterar los resultados foreach ($cursor as $obj) {     echo $obj["titulo"] . "n"; } ?> Saturday, June 16, 2012
  • 43. Almacenamiento de Archivos <?php // guardar un archivo $id = $grid->storeFile("libro.pdf"); $libro = $grid->findOne(); // agregar un contador de descargas $libro->file['descargas'] = 0; $grid->save($libro->file); // incrementar el contador $grid->update(array("_id" => $id), array('$inc' => array ("descargas" => 1))); ?> Saturday, June 16, 2012
  • 44. Queries de SQL a Mongo http://php.net/manual/es/mongo.sqltomongo.php Saturday, June 16, 2012
  • 45. Interfaces de Administración - Genghis http://genghisapp.com/ Saturday, June 16, 2012
  • 46. Interfaces de Administración - RockMongo http://code.google.com/p/rock-php/wiki/rock_mongo Saturday, June 16, 2012
  • 47. Interfaces de Administración - php-mongodb-admin https://github.com/jwage/php-mongodb-admin Saturday, June 16, 2012
  • 48. Interfaces de Administración - mongohosting.com https://github.com/jwage/php-mongodb-admin Saturday, June 16, 2012
  • 49. Librerias en PHP - Doctrine ODM Saturday, June 16, 2012
  • 50. Librerias en PHP - Doctrine ODM - Mandango Saturday, June 16, 2012
  • 51. Librerias en PHP - Doctrine ODM - Mandango - varias más... Saturday, June 16, 2012
  • 52. Doctrine MongoDB ODM http://doctrine-project.org Doctrine MongoDB Object Document Mapper (ODM) está desarrollado para PHP 5.3.2+ y provee persistencia transparente de objetos PHP. Saturday, June 16, 2012
  • 53. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 54. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 55. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 56. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 57. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 58. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 59. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 60. Doctrine MongoDB ODM Tipos de Mappings bin_data_custom float bin_data_func hash bin_data_md5 id bin_data int bin_data_uuid key boolean string date timestamp file increment Saturday, June 16, 2012
  • 61. Doctrine MongoDB ODM Campos “AutoIncrement” <?php /** Document */ class MiClase { /** @Id(strategy="INCREMENT") */ private $id; public function getId() { return $this->id; } //... } Saturday, June 16, 2012
  • 62. Doctrine MongoDB ODM Tipos propios <?php namespace MyProjectTypes; use DoctrineDBALTypesType; use DoctrineDBALPlatformsAbstractPlatform; /** * My custom datatype. */ class MyType extends Type { public function convertToPHPValue($value) { // This is executed when the value is read from the database. Make your conversions here. } public function convertToDatabaseValue($value) { // This is executed when the value is written to the database. Make your conversions here. } } Saturday, June 16, 2012
  • 63. Doctrine MongoDB ODM Múltiples tipos en una misma colección /** * @Document(collection="documentos") * @DiscriminatorField(fieldName="type") * @DiscriminatorMap({"article"="Articulo", "album"="Album"}) */ class Articulo { // ... } /** * @Document(collection="documentos") * @DiscriminatorField(fieldName="type") * @DiscriminatorMap({"article"="Articulo", "album"="Album"}) */ class Album { // ... } Saturday, June 16, 2012
  • 64. Doctrine MongoDB ODM /** @Document */ class Usuario { /** @Id */ private $id; /** @String */ private $nombre; /** @String */ private $email; /** @ReferenceMany(targetDocument="Articulo", cascade="all") */ private $articulos = array(); // ... } Saturday, June 16, 2012
  • 65. Doctrine MongoDB ODM /** @Document */ class Articulo { /** @Id */ private $id; /** @String */ private $titulo; /** @String */ private $contenido; /** @Date */ private $createdAt; // ... } Saturday, June 16, 2012
  • 66. Doctrine MongoDB ODM <?php // crear un usuario $user = new Usuario(); $user->setNombre('Juan P.'); $user->setEmail('email@example.com'); // avisale a Doctrine2 que guarde $usuario en el próximo flush() $dm->persist($usuario); // crear un articulo $articulo = new Articulo(); $articulo->setTitulo('Mi primer articulo'); $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!'); $articulo->setCreatedAt(new DateTime()); $user->agregarArticulo($articulo); // guarda todo en MongoDB $dm->flush(); Saturday, June 16, 2012
  • 67. Doctrine MongoDB ODM <?php // crear un usuario $usuario = new Usuario(); $usuario->setNombre('Juan P.'); $usuario->setEmail('email@example.com'); // avisale a Doctrine2 que guarde $usuario en el próximo flush() $dm->persist($usuario); // crear un articulo $articulo = new Articulo(); $articulo->setTitulo('Mi primer articulo'); $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!'); $articulo->setCreatedAt(new DateTime()); $user->addArticulo($articulo); // guarda todo en MongoDB $dm->flush($usuario); Saturday, June 16, 2012
  • 68. Doctrine MongoDB ODM <?php // crear un usuario $user = new Usuario(); $user->setNombre('Juan P.'); $user->setEmail('email@example.com'); // avisale a Doctrine2 que guarde $usuario en el próximo flush() $dm->persist($usuario); // crear un articulo $articulo = new Articulo(); $articulo->setTitulo('Mi primer articulo'); $articulo->setContenido('MongoDB + Doctrine 2 ODM = espectacular!'); $articulo->setCreatedAt(new DateTime()); $user->agregarArticulo($articulo); // guarda todo en MongoDB $dm->flush($usuario, false); Saturday, June 16, 2012
  • 69. Doctrine MongoDB ODM Array ( [_id] => 4bec5869fdc212081d000000 [titulo] => My First Blog Post [contenido] => MongoDB + Doctrine 2 ODM = awesomeness! [createdAt] => MongoDate Object ( [sec] => 1273723200 [usec] => 0 ) ) Saturday, June 16, 2012
  • 70. Doctrine MongoDB ODM Array ( [_id] => 4bec5869fdc212081d010000 [nombre] => Bulat S. [email] => email@example.com [articulos] => Array ( [0] => Array ( [$ref] => Articulo [$id] => 4bec5869fdc212081d000000 [$db] => test_database ) ) ) Saturday, June 16, 2012
  • 71. Doctrine MongoDB ODM $usuario = $dm->find('Usuario', $idDelUsuario); $usuario = $dm->getRepository('Usuario')->findOneByNombre('Juan'); $articulos = $usuario->getArticulos(); foreach ($articulos as $articulo) { echo $articulo; } Saturday, June 16, 2012
  • 72. Doctrine MongoDB ODM Repositorios de documents // src/TuNamespace/TuBundle/ServerRepository.php namespace TuNamespaceTuBundle; use DoctrineODMMongoDBDocumentRepository; class ServerRepository extends DocumentRepository { public function getActiveServers() { return $this->createQueryBuilder() ->field('isActive')->equals(true) ->sort('name', 'asc')->getQuery()->execute(); } Usage $rep = $dm->getRepository(‘@TuBundle/Server’); $servers = $rep->getActiveServers(); Saturday, June 16, 2012
  • 73. Doctrine MongoDB ODM /** @Document */ class Imagen { /** @Id */ private $id; /** @Field */ private $nombre; /** @File */ private $file; Saturday, June 16, 2012
  • 74. Doctrine MongoDB ODM // guardar archivo $imagen = new Imagen(); $imagen->setNombre('Imagen de prueba'); $imagen->setFile('/path/to/imagen.png'); $dm->persist($imagen); $dm->flush(); // obtener documento y enviar archivo al cliente HTTP $imagen = $dm->createQueryBuilder('DocumentsImagen') ->field('nombre')->equals('Imagen de prueba') ->getQuery() ->getSingleResult(); header('Content-type: image/png;'); echo $imagen->getFile()->getBytes(); Saturday, June 16, 2012
  • 77. Bundles de Symfony2 - DoctrineMongoDBBundle Saturday, June 16, 2012
  • 78. Bundles de Symfony2 - DoctrineMongoDBBundle - MandangoBundle Saturday, June 16, 2012
  • 79. DoctrineMongoDBBundle Instalación en Symfony 2.0 deps [doctrine-mongodb] git=http://github.com/doctrine/mongodb.git [doctrine-mongodb-odm] git=http://github.com/doctrine/mongodb-odm.git [DoctrineMongoDBBundle] git=http://github.com/doctrine/DoctrineMongoDBBundle.git target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle version=v2.0.0 $ ./bin/vendors install Saturday, June 16, 2012
  • 80. DoctrineMongoDBBundle Instalación en Symfony 2.1 con Composer composer.json { require: { "doctrine/mongodb-odm-bundle": "dev-master" } } $ php composer.phar update Saturday, June 16, 2012
  • 81. DoctrineMongoDBBundle Configurando Symfony2.1 app/autoload.php use DoctrineCommonAnnotationsAnnotationRegistry; AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/ mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/ DoctrineAnnotations.php'); Saturday, June 16, 2012
  • 82. DoctrineMongoDBBundle Configurando Symfony2.1 app/config/config.yml doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: connect: true default_database: test_database document_managers: default: auto_mapping: true Saturday, June 16, 2012
  • 83. DoctrineMongoDBBundle app/config/config.yml doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: connect: true usage: server: mongodb://user:pass@db1.mongohosting.com:27017 options: replicaSet: true connect: true default_database: test_database document_managers: default: mappings: SGCBundle: ~ SGCRepositoryAppBundle: yml MiBundle: { type: xml, dir: Resources/config/doctrine/ mapping } Saturday, June 16, 2012
  • 84. DoctrineMongoDBBundle Definiendo Documentos Saturday, June 16, 2012
  • 85. DoctrineMongoDBBundle Definiendo Documentos // src/Acme/StoreBundle/Document/Product.php namespace AcmeStoreBundleDocument; use DoctrineODMMongoDBMappingAnnotations as MongoDB; /** * @MongoDBDocument(collection="product") */ class Product { /** * @MongoDBId */ protected $id; /** * @MongoDBString @MongoDBIndex(unique=true, order="asc") */ protected $name; Saturday, June 16, 2012
  • 86. DoctrineMongoDBBundle Usando Documentos // src/Acme/StoreBundle/Controller/DefaultController.php use AcmeStoreBundleDocumentProduct; use SymfonyComponentHttpFoundationResponse; // ... public function createAction() { $product = new Product(); $product->setName('A Foo Bar'); $product->setPrice('19.99'); $dm = $this->get('doctrine.odm.mongodb.document_manager'); $dm->persist($product); $dm->flush(); return new Response('Created product id '.$product->getId()); } Saturday, June 16, 2012
  • 87. DoctrineMongoDBBundle Consumiendo Mongo directamente // src/Acme/StoreBundle/Controller/DefaultController.php use SymfonyComponentHttpFoundationResponse; // ... public function createAction() { $dm = $this->get('doctrine.odm.mongodb.document_manager'); $mongo = $dm->getConnection()->getMongo()); $resultado = $mongo->miBD->miColleccion->find(); ... Saturday, June 16, 2012
  • 88. Formularios Debido a que los documentos son objetos simples de PHP, integrar los formularios es extremadamente sencillo. public function createAction() { $dm = $this->get('doctrine.odm.mongodb.default_document_manager'); $form = $this->createForm(new RegistrationType(), new Registration()); $form->bindRequest($this->getRequest()); if ($form->isValid()) { $registration = $form->getData(); $dm->persist($registration->getUser()); $dm->flush(); return $this->redirect(...); } http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/form.html Saturday, June 16, 2012
  • 89. Comandos Comandos de Symfony2 doctrine doctrine:mongodb:cache:clear-metadata Clear all metadata cache for a document manager. doctrine:mongodb:fixtures:load Load data fixtures to your database. doctrine:mongodb:generate:documents Generate document classes and method stubs from your mapping information. doctrine:mongodb:generate:hydrators Generates hydrator classes for document classes. doctrine:mongodb:generate:proxies Generates proxy classes for document classes. doctrine:mongodb:generate:repositories Generate repository classes from your mapping information. doctrine:mongodb:mapping:info Show basic information about all mapped documents. doctrine:mongodb:query Query mongodb and inspect the outputted results from your document classes. doctrine:mongodb:schema:create Allows you to create databases, collections and indexes for your documents doctrine:mongodb:schema:drop Allows you to drop databases, collections and indexes for your documents Saturday, June 16, 2012
  • 90. Bundles que usan MongoDB - SonataDoctrineMongoDBAdminBundle - IsmaAmbrosiGeneratorBundle - EbutikMongoSessionBundle - TranslationEditorBundle - ServerGroveLiveChat Saturday, June 16, 2012
  • 92. ¡Muchas Gracias! Transparencias: http://slideshare.net/pgodel Twitter: @pgodel Saturday, June 16, 2012