public function createDefaultCondition(CreateDefaultConditionEvent $event)
 {
     $root = new ConditionModel();
     $root->pid = $event->getCondition()->id;
     $root->sorting = 128;
     $root->type = 'and';
     $root->save();
     // page type
     $condition = new ConditionModel();
     $condition->pid = $root->id;
     $condition->sorting = 128;
     $condition->type = 'item_type';
     $condition->item_type_accepted_type = 'page';
     $condition->save();
     // page published
     $condition = new ConditionModel();
     $condition->pid = $root->id;
     $condition->sorting = 256;
     $condition->type = 'page_published';
     $condition->save();
     // page hidden
     $condition = new ConditionModel();
     $condition->pid = $root->id;
     $condition->sorting = 512;
     $condition->type = 'page_hide';
     $condition->page_hide_accepted_hide_status = '';
     $condition->save();
     // page type
     $or = new ConditionModel();
     $or->pid = $root->id;
     $or->sorting = 1024;
     $or->type = 'or';
     $or->save();
     $condition = new ConditionModel();
     $condition->pid = $or->id;
     $condition->sorting = 128;
     $condition->type = 'page_type';
     $condition->page_type_accepted_type = 'regular';
     $condition->save();
     $condition = new ConditionModel();
     $condition->pid = $or->id;
     $condition->sorting = 256;
     $condition->type = 'page_type';
     $condition->page_type_accepted_type = 'forward';
     $condition->save();
     $condition = new ConditionModel();
     $condition->pid = $or->id;
     $condition->sorting = 512;
     $condition->type = 'page_type';
     $condition->page_type_accepted_type = 'redirect';
     $condition->save();
     // login status
     $or = new ConditionModel();
     $or->pid = $root->id;
     $or->sorting = 2048;
     $or->type = 'or';
     $or->save();
     // unprotected pages
     $and = new ConditionModel();
     $and->pid = $or->id;
     $and->sorting = 128;
     $and->type = 'and';
     $and->save();
     // login status -> not protected
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 128;
     $condition->type = 'page_protected';
     $condition->page_protected_accepted_protected_status = '';
     $condition->save();
     // login status -> OR ...
     $or = new ConditionModel();
     $or->pid = $and->id;
     $or->sorting = 256;
     $or->type = 'or';
     $or->save();
     // login status -> OR -> not logged in
     $condition = new ConditionModel();
     $condition->pid = $or->id;
     $condition->sorting = 128;
     $condition->type = 'member_login';
     $condition->member_login_accepted_login_status = 'logged_out';
     $condition->save();
     // login status -> OR -> page not guests only
     $condition = new ConditionModel();
     $condition->pid = $or->id;
     $condition->sorting = 256;
     $condition->type = 'page_guests';
     $condition->page_guests_accepted_guests_status = '';
     $condition->save();
     // protected pages
     $and = new ConditionModel();
     $and->pid = $or->id;
     $and->sorting = 256;
     $and->type = 'and';
     $and->save();
     // login status -> protected
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 128;
     $condition->type = 'page_protected';
     $condition->page_protected_accepted_protected_status = '';
     $condition->save();
     // login status -> page groups
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 256;
     $condition->type = 'page_groups';
     $condition->save();
 }
 public function createDefaultCondition(CreateDefaultConditionEvent $event)
 {
     $root = new ConditionModel();
     $root->pid = $event->getCondition()->id;
     $root->sorting = 128;
     $root->type = 'and';
     $root->save();
     // article type
     $condition = new ConditionModel();
     $condition->pid = $root->id;
     $condition->sorting = 128;
     $condition->type = 'item_type';
     $condition->item_type_accepted_type = 'article';
     $condition->save();
     // article published
     $condition = new ConditionModel();
     $condition->pid = $root->id;
     $condition->sorting = 256;
     $condition->type = 'article_published';
     $condition->save();
     // login status
     $or = new ConditionModel();
     $or->pid = $root->id;
     $or->sorting = 512;
     $or->type = 'or';
     $or->save();
     // unprotected articles
     $and = new ConditionModel();
     $and->pid = $or->id;
     $and->sorting = 128;
     $and->type = 'and';
     $and->save();
     // login status -> not protected
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 128;
     $condition->type = 'article_protected';
     $condition->article_members_accepted_protected_status = '';
     $condition->save();
     // login status -> not logged in
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 256;
     $condition->type = 'member_login';
     $condition->member_login_accepted_login_status = 'logged_out';
     $condition->save();
     // login status -> article guests only
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 512;
     $condition->type = 'article_guests';
     $condition->article_guests_accepted_guests_status = '';
     $condition->save();
     // protected articles
     $and = new ConditionModel();
     $and->pid = $or->id;
     $and->sorting = 256;
     $and->type = 'and';
     $and->save();
     // login status -> protected
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 128;
     $condition->type = 'article_protected';
     $condition->article_members_accepted_protected_status = '';
     $condition->save();
     // login status -> article groups
     $condition = new ConditionModel();
     $condition->pid = $and->id;
     $condition->sorting = 256;
     $condition->type = 'article_groups';
     $condition->save();
 }