'contain' => [
'Licenses',
'Reviews'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Reviews.created' =>'DESC']);
+ },
'Users' => [
'fields' => [
'id',
],
'Screenshots',
'Userssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
]
],
'Backerssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
]
],
'Creatorssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
]
],
'Contributorssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
]
],
'Providerssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
]
],
'workswellsoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Softwares.softwarename' =>'ASC']);
+ },
'Softwares' => [
'fields' => [
'id',
]
],
'alternativeto'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Softwares.softwarename' =>'ASC']);
+ },
'Softwares' => [
'fields' => [
'id',
$software = $this->Softwares->get($id,
["contain" =>
[
- 'Userssoftwares'=> [
+ 'Userssoftwares'=>[
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
+
'fields' => [
'id',
'username',
["contain" =>
[
'Backerssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
["contain" =>
[
'Reviews'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Reviews.created' =>'DESC']);
+ },
'Users' => [
'fields' => [
'id',
["contain" =>
[
'alternativeto'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Softwares.softwarename' =>'ASC']);
+ },
'Softwares' => [
'fields' => [
'id',
["contain" =>
[
'Providerssoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Users.username' =>'ASC']);
+ },
'Users' => [
'fields' => [
'id',
["contain" =>
[
'workswellsoftwares'=> [
+ 'strategy' => 'select',
+ 'queryBuilder' => function ($q) {
+ return $q->order(['Softwares.softwarename' =>'ASC']);
+ },
'Softwares' => [
'fields' => [
'id',
$this->set('_serialize', ['softwares', 'pagination']);
}
-
- /**
- * Return all backers for a software thanks to his id.
- * @param Integer $id The software Id.
- * @return type
- */
- public function backersFor($id){
- $relationshipsTable = TableRegistry::get('relationships');
- //Get Backe by
- $backerOf = $relationshipsTable->find('all')->select(['id'])->where(['relationships.cd = ' => 'BackerOf'])->toArray();
- $backerOfId = $backerOf[0]->id;
-
- return $RelationshipsBackerOf = $this->Softwares->RelationshipsSoftwaresUsers->find('all')
- ->where(['software_id = ' => $id])
- ->andWhere(['relationship_id = ' => $backerOfId]);
- }
-
- public function createdBy($id){
- $relationshipsTable = TableRegistry::get('relationships');
- //Get Backe by
- $backerOf = $relationshipsTable->find('all')->select(['id'])->where(['relationships.cd = ' => 'CreatorOf'])->toArray();
- $backerOfId = $backerOf[0]->id;
-
- return $RelationshipsBackerOf = $this->Softwares->RelationshipsSoftwaresUsers->find('all')
- ->where(['software_id = ' => $id])
- ->andWhere(['relationship_id = ' => $backerOfId]);
- }
-
/**
* Fake function to get 4 projects
*/