public function __construct($name, $parameters = array()) { parent::__construct($name, $parameters); $this->is_primary = isset($parameters['primary']) && $parameters['primary']; $this->is_unique = isset($parameters['unique']) && $parameters['unique']; $this->is_required = isset($parameters['required']) && $parameters['required']; $this->is_autocomplete = isset($parameters['autocomplete']) && $parameters['autocomplete']; $this->column_name = isset($parameters['column_name']) ? $parameters['column_name'] : $this->name; $this->default_value = isset($parameters['default_value']) ? $parameters['default_value'] : null; }
/** * All fields in exression should be placed as %s (or as another placeholder for sprintf), * and the real field names being carrying in $buildFrom array (= args for sprintf) * * @param string $name * @param string $expression * @param array|string|null $buildFrom * @param array $parameters */ public function __construct($name, $expression, $buildFrom = null, $parameters = array()) { if (!isset($parameters['data_type'])) { $parameters['data_type'] = 'string'; } parent::__construct($name, $parameters); $this->expression = $expression; if (!is_array($buildFrom) && $buildFrom !== null) { $buildFrom = array($buildFrom); } elseif ($buildFrom === null) { $buildFrom = array(); } $this->buildFrom = $buildFrom; }
/** * @param string $name * @param string|Base $refEntity * @param array $reference * @param array $parameters * * @throws ArgumentException */ public function __construct($name, $refEntity, $reference, $parameters = array()) { parent::__construct($name); if ($refEntity instanceof Base) { $this->refEntity = $refEntity; $this->refEntityName = $refEntity->getFullName(); } else { // this one could be without leading backslash and/or with Table-postfix $this->refEntityName = Base::normalizeName($refEntity); } if (empty($reference)) { throw new ArgumentException('Reference for `' . $name . '` shouldn\'t be empty'); } $this->reference = $reference; if (isset($parameters['join_type'])) { $join_type = strtoupper($parameters['join_type']); if (in_array($join_type, array('LEFT', 'INNER', 'RIGHT'), true)) { $this->join_type = $join_type; } } }