Beispiel #1
0
 function __construct(PDO $pdo, Repository $repository, $whereRaw, array $params)
 {
     $this->pdo = $pdo;
     $this->repository = $repository;
     $this->whereRaw = $whereRaw;
     $this->params = $params;
     $this->fieldMap = $this->toFieldMap($repository->getStandardFields());
 }
Beispiel #2
0
 protected function canBeSaved(Entity $menu)
 {
     if (!$menu instanceof Menu) {
         return false;
     }
     return parent::canBeSaved($menu) && strLen($menu->getName()) > 0 && strLen($menu->getName()) <= self::NAME_MAX_LENGTH;
 }
Beispiel #3
0
 public function __construct(PDO $oDatabase)
 {
     parent::__construct($oDatabase);
     $this->idField = new Field(Field::TYPE_PRIMARY_KEY, "id", "category_id");
     $this->nameField = new Field(Field::TYPE_STRING, "name", "category_name");
     $this->descriptionField = new Field(Field::TYPE_STRING, "description", "category_description");
 }
Beispiel #4
0
 public function __construct(Website $website)
 {
     parent::__construct($website->getDatabase());
     $this->widgetDirectory = $website->getUriWidgets();
     $this->documentIdField = new Field(Field::TYPE_INT, "documentId", "sidebar_id");
     $this->widgetDataField = new Field(Field::TYPE_JSON, "widgetData", "widget_data");
     $this->widgetIdField = new Field(Field::TYPE_PRIMARY_KEY, "id", "widget_id");
     $this->widgetNameField = new Field(Field::TYPE_STRING, "widgetName", "widget_naam");
     $this->widgetPriorityField = new Field(Field::TYPE_INT, "priority", "widget_priority");
 }
Beispiel #5
0
 public function __construct(PDO $database)
 {
     parent::__construct($database);
     $this->usernameField = new Field(Field::TYPE_STRING_LOWERCASE, "username", "user_login");
     $this->displayNameField = new Field(Field::TYPE_STRING, "displayName", "user_display_name");
     $this->passwordHashedField = new Field(Field::TYPE_STRING, "passwordHashed", "user_password");
     $this->idField = new Field(Field::TYPE_PRIMARY_KEY, "id", "user_id");
     $this->emailField = new Field(Field::TYPE_STRING, "email", "user_email");
     $this->rankField = new Field(Field::TYPE_INT, "rank", "user_rank");
     $this->joinedField = new Field(Field::TYPE_DATE, "joined", "user_joined");
     $this->lastLoginField = new Field(Field::TYPE_DATE, "lastLogin", "user_last_login");
     $this->statusField = new Field(Field::TYPE_INT, "status", "user_status");
     $this->statusTextField = new Field(Field::TYPE_STRING, "statusText", "user_status_text");
     $this->extraDataField = new Field(Field::TYPE_JSON, "extraData", "user_extra_data");
 }
Beispiel #6
0
 protected function canBeSaved(Entity $comment)
 {
     if (!$comment instanceof Comment) {
         return false;
     }
     return parent::canBeSaved($comment) && strLen($comment->getBodyRaw()) >= Comment::BODY_MIN_LENGTH && strLen($comment->getBodyRaw()) <= Comment::BODY_MAX_LENGTH;
 }
Beispiel #7
0
 protected function canBeSaved(Entity $article)
 {
     if (!$article instanceof Article) {
         return false;
     }
     return parent::canBeSaved($article) && $article->isComplete();
 }
Beispiel #8
0
 protected function canBeSaved(Entity $link)
 {
     if (!$link instanceof Link) {
         return false;
     }
     return parent::canBeSaved($link) && ($link->getMenuId() > 0 || $link->getId() > 0) && strLen($link->getUrl()) <= self::MAX_URL_LENGTH && strLen($link->getText()) <= self::MAX_LINK_TEXT_LENGTH;
 }
Beispiel #9
0
 protected function canBeSaved(Entity $document)
 {
     if (!$document instanceof Document) {
         return false;
     }
     return parent::canBeSaved($document) && !$document->isForWidgetArea() && Document::isValidIntro($document->getIntro()) && Document::isValidTitle($document->getTitle());
 }