Skip to content

Commit

Permalink
Re-adding ProjectRelation model
Browse files Browse the repository at this point in the history
  • Loading branch information
REBELinBLUE committed May 31, 2015
1 parent 824e168 commit 4bd6dd1
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 98 deletions.
99 changes: 1 addition & 98 deletions app/Project.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace App;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
use Robbo\Presenter\PresentableInterface;
Expand All @@ -10,7 +9,7 @@
/**
* Project model
*/
class Project extends Model implements PresentableInterface
class Project extends ProjectRelation implements PresentableInterface
{
use SoftDeletes;

Expand Down Expand Up @@ -59,102 +58,6 @@ class Project extends Model implements PresentableInterface
'builds_to_keep' => 'integer'
];

/**
* Belongs to relationship
*
* @return Group
*/
public function group()
{
return $this->belongsTo('App\Group');
}

/**
* Has many relationship
*
* @return Server
*/
public function servers()
{
return $this->hasMany('App\Server')->orderBy('name');
}

/**
* Has many relationship
*
* @return Heartbeat
*/
public function heartbeats()
{
return $this->hasMany('App\Heartbeat')->orderBy('name');
}

/**
* Has many relationship
*
* @return Notification
*/
public function notifications()
{
return $this->hasMany('App\Notification')->orderBy('name');
}

/**
* Has many relationship
*
* @return Deployment
*/
public function deployments()
{
return $this->hasMany('App\Deployment')->orderBy('started_at', 'DESC');
}

/**
* Has many relationship
*
* @return Command
*/
public function commands()
{
return $this->hasMany('App\Command');
}

/**
* Has many relationship
* @return SharedFile
*/
public function shareFiles()
{
return $this->hasMany('App\SharedFile');
}

/**
* Has many relationship to project file
* @return ProjectFile
*/
public function projectFiles()
{
return $this->hasMany('App\ProjectFile');
}

/**
* Has many relationship
* @return SharedFile
*/
public function notifyEmails()
{
return $this->hasMany('App\NotifyEmail');
}

/**
* Has many urls to check
* @return CheckUrl
*/
public function checkUrls()
{
return $this->hasMany('App\CheckUrl');
}

/**
* Override the boot method to bind model event listeners
*
Expand Down
106 changes: 106 additions & 0 deletions app/ProjectRelation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php namespace App;

use Illuminate\Database\Eloquent\Model;

/**
* Abstract class to hold the relationships for projects to stop PHPMD complaning
* This seems like such a hacky way to structure it
*/
abstract class ProjectRelation extends Model
{
/**
* Belongs to relationship
*
* @return Group
*/
public function group()
{
return $this->belongsTo('App\Group');
}

/**
* Has many relationship
*
* @return Server
*/
public function servers()
{
return $this->hasMany('App\Server')->orderBy('name');
}

/**
* Has many relationship
*
* @return Heartbeat
*/
public function heartbeats()
{
return $this->hasMany('App\Heartbeat')->orderBy('name');
}

/**
* Has many relationship
*
* @return Notification
*/
public function notifications()
{
return $this->hasMany('App\Notification')->orderBy('name');
}

/**
* Has many relationship
*
* @return Deployment
*/
public function deployments()
{
return $this->hasMany('App\Deployment')->orderBy('started_at', 'DESC');
}

/**
* Has many relationship
*
* @return Command
*/
public function commands()
{
return $this->hasMany('App\Command');
}

/**
* Has many relationship
* @return SharedFile
*/
public function shareFiles()
{
return $this->hasMany('App\SharedFile');
}

/**
* Has many relationship to project file
* @return ProjectFile
*/
public function projectFiles()
{
return $this->hasMany('App\ProjectFile');
}

/**
* Has many relationship
* @return SharedFile
*/
public function notifyEmails()
{
return $this->hasMany('App\NotifyEmail');
}

/**
* Has many urls to check
* @return CheckUrl
*/
public function checkUrls()
{
return $this->hasMany('App\CheckUrl');
}
}

0 comments on commit 4bd6dd1

Please sign in to comment.