diff --git a/app/DoctrineMigrations/Version20170423104943.php b/app/DoctrineMigrations/Version20170423104943.php new file mode 100644 index 0000000..531484e --- /dev/null +++ b/app/DoctrineMigrations/Version20170423104943.php @@ -0,0 +1,176 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (-1, '0033B2', 0, 'Unknown')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (0, '05131D', 0, 'Black')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1, '0055BF', 0, 'Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (2, '237841', 0, 'Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (3, '008F9B', 0, 'Dark Turquoise')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (4, 'C91A09', 0, 'Red')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (5, 'C870A0', 0, 'Dark Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (6, '583927', 0, 'Brown')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (7, '9BA19D', 0, 'Light Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (8, '6D6E5C', 0, 'Dark Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (9, 'B4D2E3', 0, 'Light Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (10, '4B9F4A', 0, 'Bright Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (11, '55A5AF', 0, 'Light Turquoise')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (12, 'F2705E', 0, 'Salmon')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (13, 'FC97AC', 0, 'Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (14, 'F2CD37', 0, 'Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (15, 'FFFFFF', 0, 'White')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (17, 'C2DAB8', 0, 'Light Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (18, 'FBE696', 0, 'Light Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (19, 'E4CD9E', 0, 'Tan')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (20, 'C9CAE2', 0, 'Light Violet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (21, 'D4D5C9', 0, 'Glow In Dark Opaque')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (22, '81007B', 0, 'Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (23, '2032B0', 0, 'Dark Blue-Violet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (25, 'FE8A18', 0, 'Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (26, '923978', 0, 'Magenta')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (27, 'BBE90B', 0, 'Lime')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (28, '958A73', 0, 'Dark Tan')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (29, 'E4ADC8', 0, 'Bright Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (30, 'AC78BA', 0, 'Medium Lavender')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (31, 'E1D5ED', 0, 'Lavender')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (32, '635F52', 1, 'Trans-Black IR Lens')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (33, '0020A0', 1, 'Trans-Dark Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (34, '84B68D', 1, 'Trans-Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (35, 'D9E4A7', 1, 'Trans-Bright Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (36, 'C91A09', 1, 'Trans-Red')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (40, '635F52', 1, 'Trans-Black')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (41, 'AEEFEC', 1, 'Trans-Light Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (42, 'F8F184', 1, 'Trans-Neon Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (43, 'C1DFF0', 1, 'Trans-Very Lt Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (45, 'DF6695', 1, 'Trans-Dark Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (46, 'F5CD2F', 1, 'Trans-Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (47, 'FCFCFC', 1, 'Trans-Clear')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (52, 'A5A5CB', 1, 'Trans-Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (54, 'DAB000', 1, 'Trans-Neon Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (57, 'FF800D', 1, 'Trans-Neon Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (60, '645A4C', 0, 'Chrome Antique Brass')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (61, '6C96BF', 0, 'Chrome Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (62, '3CB371', 0, 'Chrome Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (63, 'AA4D8E', 0, 'Chrome Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (64, '1B2A34', 0, 'Chrome Black')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (68, 'F3CF9B', 0, 'Very Light Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (69, 'CD6298', 0, 'Light Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (70, '582A12', 0, 'Reddish Brown')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (71, 'A0A5A9', 0, 'Light Bluish Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (72, '6C6E68', 0, 'Dark Bluish Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (73, '5A93DB', 0, 'Medium Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (74, '73DCA1', 0, 'Medium Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (75, '000000', 0, 'Speckle Black-Copper')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (76, '635F61', 0, 'Speckle DBGray-Silver')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (77, 'FECCCF', 0, 'Light Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (78, 'F6D7B3', 0, 'Light Flesh')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (79, 'FFFFFF', 0, 'Milky White')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (80, 'A5A9B4', 0, 'Metallic Silver')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (81, '899B5F', 0, 'Metallic Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (82, 'DBAC34', 0, 'Metallic Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (84, 'CC702A', 0, 'Medium Dark Flesh')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (85, '3F3691', 0, 'Dark Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (86, '7C503A', 0, 'Dark Flesh')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (89, '4C61DB', 0, 'Royal Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (92, 'D09168', 0, 'Flesh')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (100, 'FEBABD', 0, 'Light Salmon')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (110, '4354A3', 0, 'Violet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (112, '6874CA', 0, 'Blue-Violet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (114, 'DF6695', 1, 'Glitter Trans-Dark Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (115, 'C7D23C', 0, 'Medium Lime')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (117, 'FFFFFF', 1, 'Glitter Trans-Clear')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (118, 'B3D7D1', 0, 'Aqua')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (120, 'D9E4A7', 0, 'Light Lime')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (125, 'F9BA61', 0, 'Light Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (129, 'A5A5CB', 1, 'Glitter Trans-Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (132, '000000', 0, 'Speckle Black-Silver')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (133, '000000', 0, 'Speckle Black-Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (134, 'AE7A59', 0, 'Copper')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (135, '9CA3A8', 0, 'Pearl Light Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (137, '7988A1', 0, 'Metal Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (142, 'DCBC81', 0, 'Pearl Light Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (143, 'CFE2F7', 1, 'Trans-Medium Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (148, '575857', 0, 'Pearl Dark Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (150, 'ABADAC', 0, 'Pearl Very Light Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (151, 'E6E3E0', 0, 'Very Light Bluish Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (158, 'DFEEA5', 0, 'Yellowish Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (178, 'B48455', 0, 'Flat Dark Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (179, '898788', 0, 'Flat Silver')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (182, 'F08F1C', 1, 'Trans-Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (183, 'F2F3F2', 0, 'Pearl White')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (191, 'F8BB3D', 0, 'Bright Light Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (212, '9FC3E9', 0, 'Bright Light Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (216, 'B31004', 0, 'Rust')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (226, 'FFF03A', 0, 'Bright Light Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (230, 'E4ADC8', 1, 'Trans-Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (232, '7DBFDD', 0, 'Sky Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (236, '96709F', 1, 'Trans-Light Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (272, '0A3463', 0, 'Dark Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (288, '184632', 0, 'Dark Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (294, 'BDC6AD', 1, 'Glow In Dark Trans')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (297, 'AA7F2E', 0, 'Pearl Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (308, '352100', 0, 'Dark Brown')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (313, '3592C3', 0, 'Maersk Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (320, '720E0F', 0, 'Dark Red')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (321, '078BC9', 0, 'Dark Azure')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (322, '36AEBF', 0, 'Medium Azure')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (323, 'ADC3C0', 0, 'Light Aqua')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (326, '9B9A5A', 0, 'Olive Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (334, 'BBA53D', 0, 'Chrome Gold')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (335, 'D67572', 0, 'Sand Red')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (351, 'F785B1', 0, 'Medium Dark Pink')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (366, 'FA9C1C', 0, 'Earth Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (373, '845E84', 0, 'Sand Purple')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (378, 'A0BCAC', 0, 'Sand Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (379, '6074A1', 0, 'Sand Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (383, 'E0E0E0', 0, 'Chrome Silver')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (450, 'B67B50', 0, 'Fabuland Brown')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (462, 'FFA70B', 0, 'Medium Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (484, 'A95500', 0, 'Dark Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (503, 'E6E3DA', 0, 'Very Light Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1000, 'D9D9D9', 0, 'Glow in Dark White')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1001, '9391E4', 0, 'Medium Violet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1002, 'C0F500', 1, 'Glitter Trans-Neon Green')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1003, '68BCC5', 1, 'Glitter Trans-Light Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1004, 'FCB76D', 1, 'Trans Flame Yellowish Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1005, 'FBE890', 1, 'Trans Fire Yellow')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1006, 'B4D4F7', 1, 'Trans Light Royal Blue')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (1007, '8E5597', 0, 'Reddish Lilac')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (9999, '05131D', 0, '[No Color]')"); + + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (494, 'D0D0D0', 0, 'Electric Contact Alloy')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (493, '656761', 0, 'Magnet')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (375, 'C1C2C1', 0, 'Rubber Light Gray')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (324, 'C40026', 0, 'Rubber Red')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (256, '212121', 0, 'Rubber Black')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (67, 'FFFFFF', 1, 'Rubber Trans Clear')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (38, 'FF800D', 1, 'Trans-Neon Orange')"); + $this->addSql("INSERT INTO color (id, rgb, transparent, name) VALUES (39, 'C1DFF0', 1, 'Trans Very Light Blue')"); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + } +} diff --git a/app/Resources/relations/alias_model.yml b/app/Resources/relations/alias_model.yml index 095ec1f..f0cce20 100644 --- a/app/Resources/relations/alias_model.yml +++ b/app/Resources/relations/alias_model.yml @@ -1,4 +1,7 @@ -# Define the relationship between LDraw models that are not automatically recognizabe to eliminate duplication of models +# Define the relationship between LDraw models that are not automatically recognizable to eliminate duplication of models +# (filename or content does not match the LDraw specifications or models have same shape and unique color number) +# +# This file is used during model loading process. # # format: # alias_ID: model_ID @@ -48,8 +51,6 @@ 82359: 3626b -122c02: 122c01 - # Bucket 1 x 1 x 1 Cylindrical 12884c02: 12884c01 @@ -140,6 +141,15 @@ u9105p01c03: u9105p01c02 # Figure Fabuland Elephant Head u588p02c02: u588p01c02 +92198p01c05: 92198p01c03 +92198p01c13: 92198p01c07 +92198p02c05: 92198p02c04 +92198p08c05: 92198p02c04 + +# Figure Friends Chloe +92198p02c02: 92198p02c01 +92198p04c03: 92198p02c01 + 30461c02: 30461c01 10350p01c01: 10350c01 @@ -198,7 +208,6 @@ u588p02c02: u588p01c02 32181c03: 32181c01 -76019: 76244 4107539: 76244 3680c02: 3680c01 @@ -217,4 +226,101 @@ u588p02c02: u588p01c02 4100339: 2559c01 75192: 2977c01 -4539364: 64776 \ No newline at end of file +4539364: 64776 + +92710c01: 92709 +92710c02: 92709 +92710c03: 92709 + +54779c01: 54779 +54779c02: 54779 + +# Bike 3 Wheel Motorcycle Body +30187c05: 30187c04 +30187c06: 30187c04 + +30225bp1: 30225b + +u9107p01c03: u9107p01c02 +u9107p02c02: u9107p01c02 +u9107p03c02: u9107p01c02 +u9107p03c03: u9107p01c02 +u9107p04c02: u9107p01c02 +u9107p04c03: u9107p01c02 +u9107p05c02: u9107p01c02 +u9107p05c03: u9107p01c02 +u9107p06c02: u9107p01c02 + +u9107p02c01: u9107p01c01 +u9107p03c01: u9107p01c01 +u9107p04c01: u9107p01c01 +u9107p05c01: u9107p01c01 +u9107p06c01: u9107p01c01 + +4100341: 6053c01 + +# Plane Aft Section 8 x 16 x 7 +54654c02: 54654c01 +54654c03: 54654c01 +54654c04: 54654c01 +54654c05: 54654c01 +54654c06: 54654c01 +54701p01c01: 54654c01 + +54779c01: 54779 +54779c02: 54779 + +559c02: 559c01 + +57028b: 57028a +57028c: 57028a +57028d: 57028a + +# Animal Cow Head +64835p01c01: 64835c01 +64835p02c01: 64835c01 + +64779p01c01: 64779c01 + +# Sail Trapezoidal 28 x 17 +64991c01: 64991 +64991c02: 64991 +64991c03: 64991 + +3135c02: 3135c01 +3135c03: 3135c01 + +575c02: 575c01 + +u586p02c01: u586p01c01 +u586p03c01: u586p01c01 + +u586p03c02: u586p01c02 +u586p02c02: u586p01c02 + +u586p03c03: u586p01c04 +u586p02c04: u586p01c04 + +u586p02c03: u586p01c03 + +u588p01c04: u588p01c03 +u588p02c03: u588p01c03 + +u588p02c04: u588p01c05 + +u592p01c03: u592p01c02 +u592p01c04: u592p01c02 +u592p02c02: u592p01c02 + +u592p02c01: u592p01c01 + +u590p02c02: u590p01c02 + +u600p02c01: u600p01c01 + +u600p02c02: u600p01c02 + +u595p02c02: u595p01c03 + +u9153p02c02: u9153p01c02 +u9153p02c01: u9153p01c01 \ No newline at end of file diff --git a/app/Resources/relations/part_model.yml b/app/Resources/relations/part_model.yml index 31c85be..966f381 100644 --- a/app/Resources/relations/part_model.yml +++ b/app/Resources/relations/part_model.yml @@ -1,6 +1,6 @@ # Define the relationship between LDraw models that are not automatically recognizabe to eliminate duplication of models # -# To load changes `run app:load:relation` command +# To load changes run `bin/console app:load:relation` command # # format: # rebrickable_part_ID: ldraw_model_ID @@ -207,4 +207,6 @@ tech028: 2698c01 tech029: 2698c01 33299a: 33299 -33299b: 33299 \ No newline at end of file +33299b: 33299 + +x222: 13459 \ No newline at end of file diff --git a/src/AppBundle/Controller/Rebrickable/ColorController.php b/src/AppBundle/Controller/Rebrickable/ColorController.php index 518f862..95abc87 100644 --- a/src/AppBundle/Controller/Rebrickable/ColorController.php +++ b/src/AppBundle/Controller/Rebrickable/ColorController.php @@ -2,7 +2,7 @@ namespace AppBundle\Controller\Rebrickable; -use AppBundle\Entity\Rebrickable\Color; +use AppBundle\Entity\Color; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; diff --git a/src/AppBundle/Controller/Rebrickable/SetController.php b/src/AppBundle/Controller/Rebrickable/SetController.php index 04f74df..2b9d3c5 100644 --- a/src/AppBundle/Controller/Rebrickable/SetController.php +++ b/src/AppBundle/Controller/Rebrickable/SetController.php @@ -2,7 +2,7 @@ namespace AppBundle\Controller\Rebrickable; -use AppBundle\Entity\Rebrickable\Color; +use AppBundle\Entity\Color; use AppBundle\Entity\Rebrickable\Inventory_Part; use AppBundle\Entity\Rebrickable\Inventory_Set; use AppBundle\Entity\Rebrickable\Part; diff --git a/src/AppBundle/Entity/Rebrickable/Color.php b/src/AppBundle/Entity/Color.php similarity index 82% rename from src/AppBundle/Entity/Rebrickable/Color.php rename to src/AppBundle/Entity/Color.php index e5684ed..d3fc356 100644 --- a/src/AppBundle/Entity/Rebrickable/Color.php +++ b/src/AppBundle/Entity/Color.php @@ -1,7 +1,8 @@ inventoryParts = new ArrayCollection(); + $this->subparts = new ArrayCollection(); } /** @@ -140,4 +149,12 @@ class Color return $this; } + + /** + * @return Collection + */ + public function getSubparts() + { + return $this->subparts; + } } diff --git a/src/AppBundle/Entity/LDraw/Subpart.php b/src/AppBundle/Entity/LDraw/Subpart.php index ba8c605..afc6716 100644 --- a/src/AppBundle/Entity/LDraw/Subpart.php +++ b/src/AppBundle/Entity/LDraw/Subpart.php @@ -2,6 +2,7 @@ namespace AppBundle\Entity\LDraw; +use AppBundle\Entity\Color; use Doctrine\ORM\Mapping as ORM; /** @@ -28,6 +29,14 @@ class Subpart */ private $subpart; + /** + * @var Color + * + * @ORM\Id + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Color", inversedBy="subparts") + */ + private $color; + /** * @var int * @@ -75,6 +84,22 @@ class Subpart return $this; } + /** + * @return Color + */ + public function getColor() + { + return $this->color; + } + + /** + * @param Color $color + */ + public function setColor($color) + { + $this->color = $color; + } + /** * @return int */ diff --git a/src/AppBundle/Entity/Rebrickable/Inventory_Part.php b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php index 5029730..1aea153 100644 --- a/src/AppBundle/Entity/Rebrickable/Inventory_Part.php +++ b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php @@ -2,6 +2,7 @@ namespace AppBundle\Entity\Rebrickable; +use AppBundle\Entity\Color; use Doctrine\ORM\Mapping as ORM; /** @@ -22,7 +23,7 @@ class Inventory_Part /** * @var Color * @ORM\Id - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Rebrickable\Color", inversedBy="inventoryParts") + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Color", inversedBy="inventoryParts") */ protected $color; diff --git a/src/AppBundle/Repository/ColorRepository.php b/src/AppBundle/Repository/ColorRepository.php new file mode 100644 index 0000000..4200578 --- /dev/null +++ b/src/AppBundle/Repository/ColorRepository.php @@ -0,0 +1,7 @@ +find(['parent' => $parent, 'subpart' => $child]); + return $this->find(['parent' => $parent, 'subpart' => $child, 'color' => $color]); } /** @@ -19,16 +20,23 @@ class SubpartRepository extends BaseRepository * * @return Subpart */ - public function getOrCreate($parent, $child, $count) + public function getOrCreate($parent, $child, $count, $colorId) { - if (($subpart = $this->findOneByKeys($parent, $child))) { + if (($subpart = $this->findOneByKeys($parent, $child, $colorId))) { $subpart->setCount($count); } else { $subpart = new Subpart(); + + $colorRepository = $this->getEntityManager()->getRepository(Color::class); + if(!($color = $colorRepository->find($colorId))) { + $color = $colorRepository->find(-1); + } + $subpart ->setParent($parent) ->setSubpart($child) - ->setCount($count); + ->setCount($count) + ->setColor($color); } return $subpart; diff --git a/src/AppBundle/Repository/Rebrickable/ColorRepository.php b/src/AppBundle/Repository/Rebrickable/ColorRepository.php deleted file mode 100644 index bff21c9..0000000 --- a/src/AppBundle/Repository/Rebrickable/ColorRepository.php +++ /dev/null @@ -1,9 +0,0 @@ - $count) { - // Try to find model of subpart - if (($subpartFile = $this->findSubmodelFile($subpartId, $fileContext)) !== null) { - $subModel = $this->loadModel($subpartFile); - if ($subModel) { - $subpart = $this->em->getRepository(Subpart::class)->getOrCreate($model, $subModel, $count); - $model->addSubpart($subpart); + foreach ($modelArray['subparts'] as $subpartId => $colors) { + foreach ($colors as $color => $count) { + // Try to find model of subpart + if (($subpartFile = $this->findSubmodelFile($subpartId, $fileContext)) !== null) { + $subModel = $this->loadModel($subpartFile); + if ($subModel) { + $subpart = $this->em->getRepository(Subpart::class)->getOrCreate($model, $subModel, $count, $color); + $model->addSubpart($subpart); + } + } else { + $this->logger->error('Subpart file not found', ['subpart' => $subpartId, 'model' => $modelArray]); } - } else { - $this->logger->error('Subpart file not found', ['subpart' => $subpartId, 'model' => $modelArray]); } } } @@ -217,7 +219,6 @@ class ModelLoader extends BaseLoader } } catch (ConvertingFailedException $e) { $this->logger->error($e->getMessage()); - return null; } diff --git a/src/AppBundle/Util/LDModelParser.php b/src/AppBundle/Util/LDModelParser.php index adcddeb..317c631 100644 --- a/src/AppBundle/Util/LDModelParser.php +++ b/src/AppBundle/Util/LDModelParser.php @@ -16,7 +16,12 @@ class LDModelParser * 'author' => string * 'modified' => DateTime * 'type' => string - * 'subparts' => [], + * 'subparts' => [ + * 'id' => [ + * 'color' => int + * ] + * ], + * 'parent' => sting * 'licence' => string * ]. * @@ -67,7 +72,7 @@ class LDModelParser } // 0 Name: .dat elseif (strpos($line, 'Name: ') === 0 && !isset($header['id'])) { - $model['id'] = preg_replace('/(^Name: )(.*)(.dat)/', '$2', $line); + $model['id'] = preg_replace('/(^Name: )(.*)(.dat|.DAT)/', '$2', $line); } // 0 Author: [] elseif (strpos($line, 'Author: ') === 0) { @@ -90,19 +95,23 @@ class LDModelParser $model['license'] = preg_replace('/(^!LICENSE )(.*) : (.*)$/', '$2', $line); } } elseif (strpos($line, '1 ') === 0) { - $id = strtolower($this->getReferencedModelNumber($line)); + $reference = $this->getReferencedModelNumber($line); - if (isset($model['subparts'][$id])) { - $model['subparts'][$id] = $model['subparts'][$id] + 1; + $id = strtolower($reference['id']); + $color = strtolower($reference['color']); + + // group subparts by color and id + if (isset($model['subparts'][$id][$color])) { + $model['subparts'][$id][$color] = $model['subparts'][$id][$color] + 1; } else { - $model['subparts'][$id] = 1; + $model['subparts'][$id][$color] = 1; } } elseif (!empty($line) && !in_array($line[0], ['2', '3', '4', '5'])) { throw new ErrorParsingLineException($model['id'],$line); } } - if ($this->isSticker($model['name'], $model['id'])) { + if ($this->isSticker($model['name'], $model['id']) && !in_array($model['type'], ['48_Primitive', '8_Primitive', 'Primitive', 'Subpart'])) { $model['type'] = 'Sticker'; } elseif (count($model['subparts']) == 1 && in_array($model['type'], ['Part Alias', 'Shortcut Physical_Colour', 'Shortcut Alias', 'Part Physical_Colour'])) { $model['parent'] = array_keys($model['subparts'])[0]; @@ -130,10 +139,13 @@ class LDModelParser */ public function getReferencedModelNumber($line) { - $line = ($line); + $line = strtolower(preg_replace('!\s+!', ' ', $line)); - if (preg_match('/^1(.*) (.*)\.dat$/', strtolower($line), $matches)) { - return str_replace('\\', DIRECTORY_SEPARATOR, $matches[2]); + if (preg_match('/^1 ([0-9]{1,3}) (.*) (.*)\.dat$/', $line, $matches)) { + $id = str_replace('\\', DIRECTORY_SEPARATOR, $matches[3]); + $color = $matches[1]; + + return ['id' => $id, 'color' => $color]; } return null; @@ -180,7 +192,7 @@ class LDModelParser } // Check if in format n*Daa == sticker - return preg_match('/(^.*)(d[0-9]{2})$/', $number); + return preg_match('/(^.*)(d[0-9a-z]{2})$/', $number); } /**