}
return $this->redirect(['action' => 'index']);
}
-
-
+
+
/**
* Returns all working well relationships for a specific software
* @param Integer $id
*/
public function getWorkingWellRelationshipsBySoftwareId($id=null) {
-
+
if ($id!=null && $this->request->is( 'get' ) && $this->response->type('json')) {
$relationshipsSoftwares = $this->RelationshipsSoftwares->find('all', [
'conditions' => ["software_id = "=> $id, 'Relationships.cd = ' => 'WorksWellWith']
]);
$this->set(compact('relationshipsSoftwares','id'));
-
+
$this->set('_serialize', ['relationshipsSoftwares','id']);
- }
-
+ }
+
}
-
+
/**
* Returns all Alternative to relationships for a specific software
* @param Integer $id
*/
public function getAlternativeToRelationshipsBySoftwareId($id=null) {
-
+
if ($id!=null && $this->request->is( 'get' ) && $this->response->type('json')) {
$relationshipsSoftwares = $this->RelationshipsSoftwares->find('all', [
'conditions' => ["software_id = "=> $id, 'Relationships.cd = ' => 'AlternativeTo']
]);
$this->set(compact('relationshipsSoftwares','id'));
-
+
$this->set('_serialize', ['relationshipsSoftwares','id']);
- }
-
+ }
+
}
}
[
'alternativeto'=> [
'Softwares' => [
+ 'fields' => [
+ 'id',
+ 'softwarename',
+ 'logo_directory',
+ 'photo',
+ 'description'
+ ]
+ ]
+ ]
+ ]
+ ]);
+
+ $this->set(compact('software'));
+ $this->set('_serialize', 'software');
+ }
+
+ public function servicesProviders ($id=null){
+
+ $software = $this->Softwares->get($id,
+ ["contain" =>
+ [
+ 'Providerssoftwares'=> [
+ 'Users' => [
'fields' => [
'id',
'username',
--- /dev/null
+<?php
+namespace App\Model\Table;
+
+use App\Model\Entity\Panel;
+use Cake\ORM\Query;
+use Cake\ORM\RulesChecker;
+use Cake\ORM\Table;
+use Cake\Validation\Validator;
+
+/**
+ * Panels Model
+ *
+ * @property \Cake\ORM\Association\BelongsTo $Requests
+ */
+class PanelsTable extends Table
+{
+
+ /**
+ * Initialize method
+ *
+ * @param array $config The configuration for the Table.
+ * @return void
+ */
+ public function initialize(array $config)
+ {
+ parent::initialize($config);
+
+ $this->table('panels');
+ $this->displayField('title');
+ $this->primaryKey('id');
+
+ $this->belongsTo('Requests', [
+ 'foreignKey' => 'request_id',
+ 'joinType' => 'INNER'
+ ]);
+ }
+
+ /**
+ * Default validation rules.
+ *
+ * @param \Cake\Validation\Validator $validator Validator instance.
+ * @return \Cake\Validation\Validator
+ */
+ public function validationDefault(Validator $validator)
+ {
+ $validator
+ ->uuid('id')
+ ->allowEmpty('id', 'create');
+
+ $validator
+ ->allowEmpty('panel');
+
+ $validator
+ ->allowEmpty('title');
+
+ $validator
+ ->allowEmpty('element');
+
+ $validator
+ ->allowEmpty('summary');
+
+ $validator
+ ->allowEmpty('content');
+
+ return $validator;
+ }
+
+ /**
+ * Returns a rules checker object that will be used for validating
+ * application integrity.
+ *
+ * @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
+ * @return \Cake\ORM\RulesChecker
+ */
+ public function buildRules(RulesChecker $rules)
+ {
+ $rules->add($rules->existsIn(['request_id'], 'Requests'));
+ return $rules;
+ }
+}
--- /dev/null
+<?php
+namespace App\Model\Table;
+
+use App\Model\Entity\Panel;
+use Cake\ORM\Query;
+use Cake\ORM\RulesChecker;
+use Cake\ORM\Table;
+use Cake\Validation\Validator;
+
+/**
+ * Panels Model
+ *
+ * @property \Cake\ORM\Association\BelongsTo $Requests
+ */
+class PanelsTable extends Table
+{
+
+ /**
+ * Initialize method
+ *
+ * @param array $config The configuration for the Table.
+ * @return void
+ */
+ public function initialize(array $config)
+ {
+ parent::initialize($config);
+
+ $this->table('panels');
+ $this->displayField('title');
+ $this->primaryKey('id');
+
+ $this->belongsTo('Requests', [
+ 'foreignKey' => 'request_id',
+ 'joinType' => 'INNER'
+ ]);
+ }
+
+ /**
+ * Default validation rules.
+ *
+ * @param \Cake\Validation\Validator $validator Validator instance.
+ * @return \Cake\Validation\Validator
+ */
+ public function validationDefault(Validator $validator)
+ {
+ $validator
+ ->uuid('id')
+ ->allowEmpty('id', 'create');
+
+ $validator
+ ->allowEmpty('panel');
+
+ $validator
+ ->allowEmpty('title');
+
+ $validator
+ ->allowEmpty('element');
+
+ $validator
+ ->allowEmpty('summary');
+
+ $validator
+ ->allowEmpty('content');
+
+ return $validator;
+ }
+
+ /**
+ * Returns a rules checker object that will be used for validating
+ * application integrity.
+ *
+ * @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
+ * @return \Cake\ORM\RulesChecker
+ */
+ public function buildRules(RulesChecker $rules)
+ {
+ $rules->add($rules->existsIn(['request_id'], 'Requests'));
+ return $rules;
+ }
+}
'joinType' => 'INNER'
]);
$this->belongsToMany('Users', [
- 'foreignKey' => 'relationships_software_id',
+ 'foreignKey' => 'software_id',
'targetForeignKey' => 'user_id',
'joinTable' => 'relationships_softwares_users'
]);
parent::initialize($config);
$this->table('users');
- $this->displayField('id');
+ $this->displayField('username');
$this->primaryKey('id');
$this->addBehavior('Timestamp');