This project is read-only.
1
Vote

Infinite loop when trying to publish content with taxonomy

description

I'm trying to implement movie module with taxonomy in Orchard 1.8.1
and when trying to publish content with taxonomy field I end up with an infinite loop.
What should I do?
<<<<<<<<<<<<<<< Migration :>>>>>>>>>>>>
 public int UpdateFrom3()
        {

            ContentDefinitionManager.AlterPartDefinition("MoviePart", builder =>
                builder.WithField("Genre", fld =>
                    fld.OfType("TaxonomyField")
                        .WithSetting("DisplayName", "Genre")
                        .WithSetting("TaxonomyFieldSettings.Taxonomy", "Genre")
                        .WithSetting("TaxonomyFieldSettings.LeavesOnly", "False")
                        .WithSetting("TaxonomyFieldSettings.SingleChoice", "False")
                        .WithSetting("TaxonomyFieldSettings.Hint", "Select as many Genres as you want")));

            return 4;
        }
 }
<<<<<<<<<<<<<<<<<<<< Handler :>>>>>>>>>>>>
{
    public void Enabled(Feature feature) {

            if (_taxonomyService.GetTaxonomyByName("Genre") == null)
            {
                var genre = _contentManager.New<TaxonomyPart>("Taxonomy");
                genre.Name = "Genre";
                _contentManager.Create(genre, VersionOptions.Published);

                CreateTerm(genre, "Action");
                CreateTerm(genre, "Adventure");
                CreateTerm(genre, "Animation");
                CreateTerm(genre, "Comedy");
                CreateTerm(genre, "Crime");
                CreateTerm(genre, "Documentary");
                CreateTerm(genre, "Drama");
            }
    

        }

   private void CreateTerm(TaxonomyPart genre,string genreName)
        {
            var term = _taxonomyService.NewTerm(genre);
            term.Name = genreName;
            _contentManager.Create(term, VersionOptions.Published);
        }
}

comments