Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class Projects extends \Phalcon\Mvc\Model {
/**
* @Primary
* @Identity
* @Column(type="integer", length=11, nullable=false)
*/
public $id;
/**
* @Column(type="string", length=255, nullable=false)
*/
public $name;
/**
* @Column(type="string", nullable=true)
*/
public $description;
/**
* @Column(type="string", nullable=true)
*/
public $projected_member_benifit;
/**
* @Column(type="string", nullable=true)
*/
public $projected_business_benifit;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $priority;
/**
* @Column(type="string", nullable=true)
*/
public $dependencies;
/**
* @Column(type="integer", length=11, nullable=false)
*/
public $ideation_date;
/**
* @Column(type="integer", length=11, nullable=false)
*/
public $requested_delivery_date;
/**
* @Column(type="integer", length=11, nullable=false)
*/
public $project_lead_id;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $delivery_lead_id;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $portfolio_id;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $program_id;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $pillar_id;
/**
* @Column(type="integer", length=11, nullable=false)
*/
public $creator_id;
/**
* @Column(type="integer", length=11, nullable=true)
*/
public $worklenz_number;
/**
* @var public int; Kept for release date logic
*/
public $release_dates;
public function initialize() {
/**
* User relation definitions
*/
$this->hasOne('creator_id', 'Users', 'id', array(
'alias' => 'Creator',
'foreignKey' => TRUE
));
$this->hasOne('delivery_lead_id', 'Users', 'id', array(
'alias' => 'DeliveryLead',
'foreignKey' => TRUE
));
$this->hasOne('project_lead_id', 'Users', 'id', array(
'alias' => 'ProjectLead',
'foreignKey' => TRUE
));
/**
* Secondary relation definition (1 to 1)
*/
$this->hasOne('department_id', 'Departments', 'id', array(
'foreignKey' => TRUE
));
$this->hasOne('pillar_id', 'Pillars', 'id', array(
'foreignKey' => TRUE
));
$this->hasOne('portfolio_id', 'Portfolios', 'id', array(
'foreignKey' => TRUE
));
$this->hasOne('program_id', 'Programs', 'id', array(
'foreignKey' => TRUE
));
/**
* Backwards compatible relations
*/
$this->belongsTo('id', 'Contributions', 'project_id', array(
'foreignKey' => TRUE
));
$this->belongsTo('id', 'Discoveries', 'project_id', array(
'foreignKey' => TRUE
));
$this->belongsTo('id', 'Reviews', 'project_id', array(
'foreignKey' => TRUE
));
/**
* Secondary relation definition (1 to many)
*/
$this->hasMany('id', 'Contributions', 'project_id', array(
'foreignKey' => TRUE
));
$this->hasMany('id', 'Discoveries', 'project_id', array(
'foreignKey' => TRUE
));
$this->hasMany('id', 'Reviews', 'project_id', array(
'foreignKey' => TRUE
));
$this->hasMany('id', 'ProjectsIterations', 'project_id', array(
'foreignKey' => TRUE
));
/**
* Pivot table info
*/
$this->hasMany('id', 'TeamsProjects', 'project_id', array(
'foreignKey' => TRUE
));
$this->hasMany('id', 'UsersProjects', 'project_id', array(
'foreignKey' => TRUE
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.