/** * Constructor. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('Rights'); // ensure to call the parent constructor parent::__construct(); $this->name = new String(); // add unique key to name field $this->markUnique('name'); $this->members = new Relation(); $this->markTransient('members'); $this->setupRels(); }
/** * The constructor which sets up some housekeeping attributes. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('Article'); // ensure to call the parent constructor parent::__construct(); $this->title = new String(); $this->title->setHelper('Please provide a title for the article.'); $this->title->setSize(100); $this->title->setRule("/\\w+/"); $this->section = new DEnum('Alpha\\Model\\Article::section'); $this->description = new String(); $this->description->setHelper('Please provide a brief description of the article.'); $this->description->setSize(200); $this->description->setRule("/\\w+/"); $this->bodyOnload = new String(); $this->content = new Text(); $this->headerContent = new Text(); $this->author = new String(); $this->author->setHelper('Please state the name of the author of this article'); $this->author->setSize(70); $this->author->setRule("/\\w+/"); $this->published = new Boolean(0); $this->comments = new Relation(); $this->markTransient('comments'); $this->votes = new Relation(); $this->markTransient('votes'); $this->tags = new Relation(); $this->markTransient('tags'); $this->URL = ''; $this->printURL = ''; // mark the URL attributes as transient $this->markTransient('URL'); $this->markTransient('printURL'); // mark title as unique $this->markUnique('title'); $this->markTransient('filePath'); $this->markTransient('taggedAttributes'); $this->setupRels(); }
/** * Constructor for the class. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('ArticleVote'); // ensure to call the parent constructor parent::__construct(); $this->articleOID = new Relation(); $this->articleOID->setRelatedClass('Alpha\\Model\\Article'); $this->articleOID->setRelatedClassField('OID'); $this->articleOID->setRelatedClassDisplayField('description'); $this->articleOID->setRelationType('MANY-TO-ONE'); $this->personOID = new Relation(); $this->personOID->setRelatedClass('Alpha\\Model\\Person'); $this->personOID->setRelatedClassField('OID'); $this->personOID->setRelatedClassDisplayField('email'); $this->personOID->setRelationType('MANY-TO-ONE'); $this->score = new Integer(); }
/** * Constructor for the class. * * @since 1.2 */ public function __construct() { self::$logger = new Logger('BlacklistedIP'); // ensure to call the parent constructor parent::__construct(); $this->IP = new String(); $this->markUnique('IP'); }
/** * Constructor. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('ActionLog'); // ensure to call the parent constructor parent::__construct(); $this->client = new String(); $this->IP = new String(); $this->message = new String(); $this->personOID = new Relation(); $this->personOID->setRelatedClass('Alpha\\Model\\Person'); $this->personOID->setRelatedClassField('OID'); $this->personOID->setRelatedClassDisplayField('displayName'); $this->personOID->setRelationType('MANY-TO-ONE'); $this->personOID->setValue($this->created_by->getValue()); }
/** * The constructor. * * @throws Alpha\Exception\FailedLookupCreateException * @throws Alpha\Exception\IllegalArguementException * * @since 1.0 */ public function __construct($leftClassName, $rightClassName) { self::$logger = new Logger('RelationLookup'); self::$logger->debug('>>__construct(leftClassName=[' . $leftClassName . '], rightClassName=[' . $rightClassName . '])'); // ensure to call the parent constructor parent::__construct(); if (empty($leftClassName) || empty($rightClassName)) { throw new IllegalArguementException('Cannot create RelationLookup object without providing the left and right class names!'); } $this->leftClassName = $leftClassName; $this->rightClassName = $rightClassName; $this->leftID = new Integer(); $this->rightID = new Integer(); $this->markTransient('leftClassName'); $this->markTransient('rightClassName'); $this->markTransient('helper'); $this->markTransient('TABLE_NAME'); // add a unique composite key to these fields $this->markUnique('leftID', 'rightID'); // make sure the lookup table exists if (!$this->checkTableExists() && ActiveRecord::isInstalled()) { // first make sure that the two BO tables exist before relating them with a lookup table if (ActiveRecord::checkBOTableExists($leftClassName) && ActiveRecord::checkBOTableExists($rightClassName)) { $this->makeTable(); } else { throw new FailedLookupCreateException('Error trying to create a lookup table [' . $this->getTableName() . '], as tables for BOs [' . $leftClassName . '] or [' . $rightClassName . '] don\'t exist!'); } } self::$logger->debug('<<__construct'); }
/** * The constructor. * * @since 1.0 */ public function __construct() { // ensure to call the parent constructor parent::__construct(); $this->validationRule = Validator::ALLOW_ALL; $this->sequence = new Integer(); $this->prefix = new String(); $this->prefix->setRule(Validator::REQUIRED_ALPHA_UPPER); $this->prefix->setHelper('Sequence prefix must be uppercase string!'); $this->markUnique('prefix'); $this->markTransient('helper'); $this->markTransient('validationRule'); $this->markTransient('size'); }
/** * constructor for the class. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('ArticleComment'); // ensure to call the parent constructor parent::__construct(); $this->articleOID = new Relation(); $this->articleOID->setRelatedClass('Alpha\\Model\\Article'); $this->articleOID->setRelatedClassField('OID'); $this->articleOID->setRelatedClassDisplayField('description'); $this->articleOID->setRelationType('MANY-TO-ONE'); $this->content = new Text(); $this->content->setAllowHTML(false); }
/** * Constructor for the class that populates all of the complex types with default values. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('Person'); self::$logger->debug('>>__construct()'); // ensure to call the parent constructor parent::__construct(); $this->displayName = new String(); $this->displayName->setRule(Validator::REQUIRED_USERNAME); $this->displayName->setSize(70); $this->displayName->setHelper('Please provide a name for display on the website (only letters, numbers, and .-_ characters are allowed!).'); $this->email = new String(); $this->email->setRule(Validator::REQUIRED_EMAIL); $this->email->setSize(70); $this->email->setHelper('Please provide a valid e-mail address as your username.'); $this->password = new String(); $this->password->setSize(70); $this->password->setHelper('Please provide a password for logging in.'); $this->password->isPassword(true); $this->state = new Enum(array('Active', 'Disabled')); $this->state->setValue('Active'); $this->URL = new String(); $this->URL->setRule(Validator::OPTIONAL_HTTP_URL); $this->URL->setHelper('URLs must be in the format http://some_domain/ or left blank!'); // add unique keys to displayName and email (which is effectively the username in Alpha) $this->markUnique('displayName'); $this->markUnique('email'); $this->rights = new Relation(); $this->markTransient('rights'); $this->actions = new Relation(); $this->markTransient('actions'); $this->setupRels(); self::$logger->debug('<<__construct'); }
/** * Constructor that sets up the DEnum options. * * @param Alpha\Model\Type\String $name */ public function __construct($name = null) { self::$logger = new Logger('DEnum'); // ensure to call the parent constructor parent::__construct(); $this->markTransient('options'); $this->markTransient('value'); $this->markTransient('helper'); $this->name = new String($name); if (isset($name) && $this->checkTableExists()) { try { $this->loadByAttribute('name', $name); } catch (RecordNotFoundException $e) { // DEnum does not exist so create it $this->save(); } try { $this->getOptions(); } catch (AlphaException $e) { self::$logger->warn($e->getMessage()); } } }
/** * Constructor for the class. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('BadRequest'); self::$logger->debug('>>__construct()'); // ensure to call the parent constructor parent::__construct(); $this->client = new String(); $this->IP = new String(); $this->requestedResource = new String(); self::$logger->debug('<<__construct'); }
/** * The constructor. * * @since 1.0 */ public function __construct() { self::$logger = new Logger('Tag'); // ensure to call the parent constructor parent::__construct(); $this->taggedClass = new String(); $this->taggedOID = new Integer(); $this->content = new String(); $this->markUnique('taggedClass', 'taggedOID', 'content'); }
/** * The constructor. * * @since 1.0 */ public function __construct() { // ensure to call the parent constructor parent::__construct(); $this->value = new String(); $this->value->setRule(Validator::REQUIRED_STRING); $this->value->setHelper('A blank dropdown value is not allowed!'); $this->DEnumID = new Integer(); $this->markTransient('helper'); }