@@ -27,9 +27,10 @@ public function __construct(EntityManagerInterface $em)
2727 $ this ->em = $ em ;
2828 }
2929
30- public function sync (ContentTypeFactory $ contentTypeFactory , Environment $ environment ) {
31- foreach ($ contentTypeFactory ->all () as $ contentType ) {
32- if (!$ record = $ this ->em ->getRepository (ContentType::class)->findOneBy (['name ' => $ contentType ->getName (), 'environment ' => $ environment ->getId ()])){
30+ public function sync (ContentTypeFactory $ contentTypeFactory , Environment $ environment )
31+ {
32+ foreach ($ contentTypeFactory ->all () as $ contentType ) {
33+ if (!$ record = $ this ->em ->getRepository (ContentType::class)->findOneBy (['name ' => $ contentType ->getName (), 'environment ' => $ environment ->getId ()])) {
3334 // INSERT
3435 $ record = new ContentType ();
3536 $ record ->hydrate ($ contentType , $ environment );
@@ -49,9 +50,10 @@ public function sync(ContentTypeFactory $contentTypeFactory, Environment $enviro
4950 * @param TapestryTaxonomy[] $taxonomies
5051 * @param Environment $environment
5152 */
52- private function syncTaxonomyToContentType (ContentType $ contentType , array $ taxonomies , Environment $ environment ) {
53+ private function syncTaxonomyToContentType (ContentType $ contentType , array $ taxonomies , Environment $ environment )
54+ {
5355 /** @var TapestryTaxonomy $taxonomy */
54- foreach ($ taxonomies as $ taxonomy ) {
56+ foreach ($ taxonomies as $ taxonomy ) {
5557 if (!$ record = $ this ->em ->getRepository (Taxonomy::class)->findOneBy (['name ' => $ taxonomy ->getName ()])) {
5658 $ record = new Taxonomy ();
5759 $ record ->hydrate ($ taxonomy );
@@ -64,7 +66,7 @@ private function syncTaxonomyToContentType(ContentType $contentType, array $taxo
6466 }
6567
6668 foreach ($ taxonomy ->getFileList () as $ classification => $ files ) {
67- if (! $ classificationRecord = $ this ->em ->getRepository (Classification::class)->findOneBy (['name ' => $ classification ])){
69+ if (!$ classificationRecord = $ this ->em ->getRepository (Classification::class)->findOneBy (['name ' => $ classification ])) {
6870 $ classificationRecord = new Classification ();
6971 $ classificationRecord ->setName ($ classification );
7072 $ this ->em ->persist ($ classificationRecord );
@@ -73,9 +75,9 @@ private function syncTaxonomyToContentType(ContentType $contentType, array $taxo
7375 $ classificationRecord ->addTaxonomy ($ record );
7476 $ this ->em ->flush ();
7577
76- foreach (array_keys ($ files ) as $ filename ) {
78+ foreach (array_keys ($ files ) as $ filename ) {
7779 /** @var File $file */
78- if ($ file = $ this ->em ->getRepository (File::class)->findOneBy (['uid ' => $ filename , 'environment ' => $ environment ->getId ()])){
80+ if ($ file = $ this ->em ->getRepository (File::class)->findOneBy (['uid ' => $ filename , 'environment ' => $ environment ->getId ()])) {
7981 $ file ->addClassification ($ classificationRecord );
8082 $ this ->em ->persist ($ file );
8183 }
0 commit comments