diff --git a/PHPCI/Model/Base/BuildBase.php b/PHPCI/Model/Base/BuildBase.php index 119290e2..728efc37 100644 --- a/PHPCI/Model/Base/BuildBase.php +++ b/PHPCI/Model/Base/BuildBase.php @@ -118,7 +118,7 @@ class BuildBase extends Model 'default' => null, ), 'log' => array( - 'type' => 'text', + 'type' => 'mediumtext', 'nullable' => true, 'default' => null, ), diff --git a/PHPCI/Model/Base/BuildMetaBase.php b/PHPCI/Model/Base/BuildMetaBase.php index 0ac8fa93..dc018819 100644 --- a/PHPCI/Model/Base/BuildMetaBase.php +++ b/PHPCI/Model/Base/BuildMetaBase.php @@ -99,7 +99,7 @@ class BuildMetaBase extends Model 'default' => null, ), 'meta_value' => array( - 'type' => 'text', + 'type' => 'mediumtext', 'default' => null, ), ); diff --git a/PHPCI/Model/Base/UserBase.php b/PHPCI/Model/Base/UserBase.php index e9be15a0..fe71baf8 100644 --- a/PHPCI/Model/Base/UserBase.php +++ b/PHPCI/Model/Base/UserBase.php @@ -106,6 +106,8 @@ class UserBase extends Model public $indexes = array( 'PRIMARY' => array('unique' => true, 'columns' => 'id'), 'idx_email' => array('unique' => true, 'columns' => 'email'), + 'email' => array('unique' => true, 'columns' => 'email'), + 'name' => array('unique' => true, 'columns' => 'name'), ); /** diff --git a/PHPCI/Store/Base/BuildMetaStoreBase.php b/PHPCI/Store/Base/BuildMetaStoreBase.php index 7a3d4159..6c4cfc15 100644 --- a/PHPCI/Store/Base/BuildMetaStoreBase.php +++ b/PHPCI/Store/Base/BuildMetaStoreBase.php @@ -20,24 +20,11 @@ class BuildMetaStoreBase extends Store protected $modelName = '\PHPCI\Model\BuildMeta'; protected $primaryKey = 'id'; - /** - * Returns a BuildMeta model by primary key. - * @param mixed $value - * @param string $useConnection - * @return \@appNamespace\Model\BuildMeta|null - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Returns a BuildMeta model by Id. - * @param mixed $value - * @param string $useConnection - * @throws HttpException - * @return \@appNamespace\Model\BuildMeta|null - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -57,14 +44,6 @@ class BuildMetaStoreBase extends Store return null; } - /** - * Returns an array of BuildMeta models by ProjectId. - * @param mixed $value - * @param int $limit - * @param string $useConnection - * @throws HttpException - * @return array - */ public function getByProjectId($value, $limit = 1000, $useConnection = 'read') { if (is_null($value)) { @@ -93,14 +72,6 @@ class BuildMetaStoreBase extends Store } } - /** - * Returns an array of BuildMeta models by BuildId. - * @param mixed $value - * @param int $limit - * @param string $useConnection - * @throws HttpException - * @return array - */ public function getByBuildId($value, $limit = 1000, $useConnection = 'read') { if (is_null($value)) { diff --git a/PHPCI/Store/Base/BuildStoreBase.php b/PHPCI/Store/Base/BuildStoreBase.php index 0560d72b..89d3a82f 100644 --- a/PHPCI/Store/Base/BuildStoreBase.php +++ b/PHPCI/Store/Base/BuildStoreBase.php @@ -20,24 +20,11 @@ class BuildStoreBase extends Store protected $modelName = '\PHPCI\Model\Build'; protected $primaryKey = 'id'; - /** - * Returns a Build model by primary key. - * @param mixed $value - * @param string $useConnection - * @return \@appNamespace\Model\Build|null - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Returns a Build model by Id. - * @param mixed $value - * @param string $useConnection - * @throws HttpException - * @return \@appNamespace\Model\Build|null - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -57,14 +44,6 @@ class BuildStoreBase extends Store return null; } - /** - * Returns an array of Build models by ProjectId. - * @param mixed $value - * @param int $limit - * @param string $useConnection - * @throws HttpException - * @return array - */ public function getByProjectId($value, $limit = 1000, $useConnection = 'read') { if (is_null($value)) { @@ -93,14 +72,6 @@ class BuildStoreBase extends Store } } - /** - * Returns an array of Build models by Status. - * @param mixed $value - * @param int $limit - * @param string $useConnection - * @throws HttpException - * @return array - */ public function getByStatus($value, $limit = 1000, $useConnection = 'read') { if (is_null($value)) { diff --git a/PHPCI/Store/Base/UserStoreBase.php b/PHPCI/Store/Base/UserStoreBase.php index f2893ac5..90d60cb4 100644 --- a/PHPCI/Store/Base/UserStoreBase.php +++ b/PHPCI/Store/Base/UserStoreBase.php @@ -20,24 +20,11 @@ class UserStoreBase extends Store protected $modelName = '\PHPCI\Model\User'; protected $primaryKey = 'id'; - /** - * Returns a User model by primary key. - * @param mixed $value - * @param string $useConnection - * @return \@appNamespace\Model\User|null - */ public function getByPrimaryKey($value, $useConnection = 'read') { return $this->getById($value, $useConnection); } - /** - * Returns a User model by Id. - * @param mixed $value - * @param string $useConnection - * @throws HttpException - * @return \@appNamespace\Model\User|null - */ public function getById($value, $useConnection = 'read') { if (is_null($value)) { @@ -57,13 +44,6 @@ class UserStoreBase extends Store return null; } - /** - * Returns a User model by Email. - * @param string $value - * @param string $useConnection - * @throws HttpException - * @return \@appNamespace\Model\User|null - */ public function getByEmail($value, $useConnection = 'read') { if (is_null($value)) { @@ -82,23 +62,16 @@ class UserStoreBase extends Store return null; } - - /** - * Returns a User model by Email. - * @param string $value - * @param string $useConnection - * @throws HttpException - * @return \@appNamespace\Model\User|null - */ - public function getByLoginOrEmail($value, $useConnection = 'read') + + public function getByName($value, $useConnection = 'read') { if (is_null($value)) { throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.'); } - $query = 'SELECT * FROM `user` WHERE `name` = :value OR `email` = :value LIMIT 1'; + $query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT 1'; $stmt = Database::getConnection($useConnection)->prepare($query); - $stmt->bindValue(':value', $value); + $stmt->bindValue(':name', $value); if ($stmt->execute()) { if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {