Making the public key a property that we store for projects, and displaying it for later use.

This commit is contained in:
Dan Cryer 2014-04-30 14:14:23 +01:00
commit 195d85a82c
9 changed files with 816 additions and 655 deletions

View file

@ -16,11 +16,9 @@ use PHPCI\Model\Project;
*/
class ProjectStoreBase extends Store
{
protected $tableName = 'project';
protected $modelName = '\PHPCI\Model\Project';
protected $primaryKey = 'id';
protected $tableName = 'project';
protected $modelName = '\PHPCI\Model\Project';
protected $primaryKey = 'id';
public function getByPrimaryKey($value, $useConnection = 'read')
{
@ -34,7 +32,7 @@ class ProjectStoreBase extends Store
}
$query = 'SELECT * FROM `project` WHERE `id` = :id LIMIT 1';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':id', $value);
if ($stmt->execute()) {
@ -42,6 +40,7 @@ class ProjectStoreBase extends Store
return new Project($data);
}
}
return null;
}
@ -52,13 +51,15 @@ class ProjectStoreBase extends Store
}
$add = '';
if ($limit) {
$add .= ' LIMIT ' . $limit;
}
$count = null;
$query = 'SELECT * FROM `project` WHERE `title` = :title' . $add;
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':title', $value);
if ($stmt->execute()) {