Browse Source

Ajout des entités ElementType et Tag (ainsi que les relations)

bastien 13 years ago
parent
commit
1e7f8a6a25
2 changed files with 161 additions and 0 deletions
  1. 123 0
      app/logs/dev.log
  2. 38 0
      src/Muzich/CoreBundle/Entity/Element.php

+ 123 - 0
app/logs/dev.log View File

@@ -2490,3 +2490,126 @@
2490 2490
 [2011-09-07 16:58:08] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse". [] []
2491 2491
 [2011-09-07 16:58:08] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] []
2492 2492
 [2011-09-07 16:58:08] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []
2493
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT
2494
+                    c.relname, n.nspname AS schemaname
2495
+                FROM
2496
+                   pg_class c, pg_namespace n
2497
+                WHERE relkind = 'S' AND n.oid = c.relnamespace AND 
2498
+                    (n.nspname NOT LIKE 'pg_%' AND n.nspname != 'information_schema') ([]) [] []
2499
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT min_value, increment_by FROM product_id_seq ([]) [] []
2500
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT tablename AS table_name, schemaname AS schema_name
2501
+                FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' ([]) [] []
2502
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT
2503
+                    a.attnum,
2504
+                    a.attname AS field,
2505
+                    t.typname AS type,
2506
+                    format_type(a.atttypid, a.atttypmod) AS complete_type,
2507
+                    (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
2508
+                    (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM pg_catalog.pg_type t2
2509
+                     WHERE t2.typtype = 'd' AND t2.typname = format_type(a.atttypid, a.atttypmod)) AS domain_complete_type,
2510
+                    a.attnotnull AS isnotnull,
2511
+                    (SELECT 't'
2512
+                     FROM pg_index
2513
+                     WHERE c.oid = pg_index.indrelid
2514
+                        AND pg_index.indkey[0] = a.attnum
2515
+                        AND pg_index.indisprimary = 't'
2516
+                    ) AS pri,
2517
+                    (SELECT pg_attrdef.adsrc
2518
+                     FROM pg_attrdef
2519
+                     WHERE c.oid = pg_attrdef.adrelid
2520
+                        AND pg_attrdef.adnum=a.attnum
2521
+                    ) AS default,
2522
+                    (SELECT pg_description.description
2523
+                        FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid
2524
+                    ) AS comment
2525
+                    FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n
2526
+                    WHERE c.relname = 'product'
2527
+                        AND a.attnum > 0
2528
+                        AND a.attrelid = c.oid
2529
+                        AND a.atttypid = t.oid
2530
+                        AND n.oid = c.relnamespace
2531
+                    ORDER BY a.attnum ([]) [] []
2532
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef
2533
+                  FROM pg_catalog.pg_constraint r
2534
+                  WHERE r.conrelid =
2535
+                  (
2536
+                      SELECT c.oid
2537
+                      FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n
2538
+                      WHERE c.relname = 'product'
2539
+                        AND n.oid = c.relnamespace
2540
+                  )
2541
+                  AND r.contype = 'f' ([]) [] []
2542
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT relname, pg_index.indisunique, pg_index.indisprimary,
2543
+                       pg_index.indkey, pg_index.indrelid
2544
+                 FROM pg_class, pg_index
2545
+                 WHERE oid IN (
2546
+                    SELECT indexrelid
2547
+                    FROM pg_index si, pg_class sc, pg_namespace sn
2548
+                    WHERE sc.relname = 'product' AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid
2549
+                 ) AND pg_index.indexrelid = oid ([]) [] []
2550
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT attnum, attname FROM pg_attribute
2551
+                WHERE attrelid=16390 AND attnum IN (1 ) ORDER BY attnum ASC; ([]) [] []
2552
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT
2553
+                    c.relname, n.nspname AS schemaname
2554
+                FROM
2555
+                   pg_class c, pg_namespace n
2556
+                WHERE relkind = 'S' AND n.oid = c.relnamespace AND 
2557
+                    (n.nspname NOT LIKE 'pg_%' AND n.nspname != 'information_schema') ([]) [] []
2558
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT min_value, increment_by FROM product_id_seq ([]) [] []
2559
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT tablename AS table_name, schemaname AS schema_name
2560
+                FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' ([]) [] []
2561
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT
2562
+                    a.attnum,
2563
+                    a.attname AS field,
2564
+                    t.typname AS type,
2565
+                    format_type(a.atttypid, a.atttypmod) AS complete_type,
2566
+                    (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
2567
+                    (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM pg_catalog.pg_type t2
2568
+                     WHERE t2.typtype = 'd' AND t2.typname = format_type(a.atttypid, a.atttypmod)) AS domain_complete_type,
2569
+                    a.attnotnull AS isnotnull,
2570
+                    (SELECT 't'
2571
+                     FROM pg_index
2572
+                     WHERE c.oid = pg_index.indrelid
2573
+                        AND pg_index.indkey[0] = a.attnum
2574
+                        AND pg_index.indisprimary = 't'
2575
+                    ) AS pri,
2576
+                    (SELECT pg_attrdef.adsrc
2577
+                     FROM pg_attrdef
2578
+                     WHERE c.oid = pg_attrdef.adrelid
2579
+                        AND pg_attrdef.adnum=a.attnum
2580
+                    ) AS default,
2581
+                    (SELECT pg_description.description
2582
+                        FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid
2583
+                    ) AS comment
2584
+                    FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n
2585
+                    WHERE c.relname = 'product'
2586
+                        AND a.attnum > 0
2587
+                        AND a.attrelid = c.oid
2588
+                        AND a.atttypid = t.oid
2589
+                        AND n.oid = c.relnamespace
2590
+                    ORDER BY a.attnum ([]) [] []
2591
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef
2592
+                  FROM pg_catalog.pg_constraint r
2593
+                  WHERE r.conrelid =
2594
+                  (
2595
+                      SELECT c.oid
2596
+                      FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n
2597
+                      WHERE c.relname = 'product'
2598
+                        AND n.oid = c.relnamespace
2599
+                  )
2600
+                  AND r.contype = 'f' ([]) [] []
2601
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT relname, pg_index.indisunique, pg_index.indisprimary,
2602
+                       pg_index.indkey, pg_index.indrelid
2603
+                 FROM pg_class, pg_index
2604
+                 WHERE oid IN (
2605
+                    SELECT indexrelid
2606
+                    FROM pg_index si, pg_class sc, pg_namespace sn
2607
+                    WHERE sc.relname = 'product' AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid
2608
+                 ) AND pg_index.indexrelid = oid ([]) [] []
2609
+[2011-09-07 18:23:33] doctrine.DEBUG: SELECT attnum, attname FROM pg_attribute
2610
+                WHERE attrelid=16390 AND attnum IN (1 ) ORDER BY attnum ASC; ([]) [] []
2611
+[2011-09-07 18:23:33] doctrine.DEBUG: CREATE SEQUENCE element_id_seq INCREMENT BY 1 MINVALUE 1 START 1 ([]) [] []
2612
+[2011-09-07 18:23:33] doctrine.DEBUG: CREATE TABLE element_type (id VARCHAR(12) NOT NULL, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ([]) [] []
2613
+[2011-09-07 18:23:33] doctrine.DEBUG: CREATE TABLE element (id INT NOT NULL, element_type_id VARCHAR(12) DEFAULT NULL, url VARCHAR(1024) NOT NULL, name VARCHAR(128) NOT NULL, date_added TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id)) ([]) [] []
2614
+[2011-09-07 18:23:34] doctrine.DEBUG: CREATE INDEX IDX_41405E3932A7CCC7 ON element (element_type_id) ([]) [] []
2615
+[2011-09-07 18:23:34] doctrine.DEBUG: ALTER TABLE element ADD CONSTRAINT FK_41405E3932A7CCC7 FOREIGN KEY (element_type_id) REFERENCES element_type(id) NOT DEFERRABLE INITIALLY IMMEDIATE ([]) [] []

+ 38 - 0
src/Muzich/CoreBundle/Entity/Element.php View File

@@ -12,6 +12,18 @@ class Element
12 12
 {
13 13
   
14 14
   /**
15
+   * @ORM\ManyToOne(targetEntity="ElementType", inversedBy="elements")
16
+   * @ORM\JoinColumn(name="element_type_id", referencedColumnName="id")
17
+   */
18
+  protected $type;
19
+  
20
+  /**
21
+   * @ManyToMany(targetEntity="Tag", inversedBy="elements")
22
+   * @JoinTable(name="elements_tag")
23
+   */
24
+  private $tags;
25
+  
26
+  /**
15 27
    * @ORM\Id
16 28
    * @ORM\Column(type="integer")
17 29
    * @ORM\GeneratedValue(strategy="AUTO")
@@ -108,4 +120,30 @@ class Element
108 120
       return $this->date_added;
109 121
   }
110 122
   
123
+  /**
124
+   * Set type
125
+   *
126
+   * @param Muzich\CoreBundle\Entity\ElementType $type
127
+   */
128
+  public function setType(\Muzich\CoreBundle\Entity\ElementType $type)
129
+  {
130
+      $this->type = $type;
131
+  }
132
+
133
+  /**
134
+   * Get type
135
+   *
136
+   * @return Muzich\CoreBundle\Entity\ElementType 
137
+   */
138
+  public function getType()
139
+  {
140
+      return $this->type;
141
+  }
142
+  
143
+  
144
+  public function __construct()
145
+  {
146
+    $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
147
+  }
148
+  
111 149
 }