public function _default()
 {
     $breadcrumbs = BreadCrumbs::getInstance()->addCrumb(ucfirst(P))->addCrumb('All Reviews');
     $reviews = new ReviewEntityRepository();
     $reviews->addSimpleSelectFields(['id', 'title', 'active', 'image']);
     $reviews->addSimpleSelectFieldsAsString('"0" as `images`');
     $reviews->addOrderByField('id');
     $images = new ImageRepository();
     $images->addSimpleSelectFieldsAsString('(SELECT COUNT(*) FROM `' . $images->getDbTableName() . '` WHERE `item_id` = `' . $reviews->getDbTableName() . '`.`id` AND `item_type` = "review") AS `images`');
     $reviews->mergeWithCollection($images, 'id', 'item_id', 'left');
     $table = CmsTable::getInstance()->addData($reviews)->addColumn(ColumnImg::getInstance('image')->imgHeight('100'))->addColumn(ColumnEdit::getInstance('title')->enableOrderableColumn()->enableTranslationColumn()->setHref('?p=' . P . '&do=edit&id={%id%}'))->addColumn(ColumnData::getInstance('images')->enableOrderableColumn()->setWidth('1%')->enableRightAlign()->setHref('?p=' . P . '&do=images&id={%id%}'))->addColumn(ColumnActive::getInstance('active')->setHref('?p=' . P . '&do=_active&id={%id%}')->enableOrderableColumn()->enableAjax())->addColumn(ColumnDelete::getInstance('delete')->setHref('?p=' . P . '&do=_delete&id={%id%}'));
     echo Columns::getInstance()->add($breadcrumbs)->add('<a class="btn btn-success" href="?p=' . P . '&do=add">Add Review</a>', ['align' => 'right']);
     echo $table;
 }
 public static function getReviews()
 {
     $reviews = new ReviewEntityRepository();
     $reviews->setWhereActive(true);
     return $reviews->getAsArrayOfObjects();
 }