mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 07:57:33 -05:00 
			
		
		
		
	include project in task transformer (#1645)
This commit is contained in:
		
							parent
							
								
									1b28a2b377
								
							
						
					
					
						commit
						507ac7387c
					
				@ -18,6 +18,7 @@ class TaskTransformer extends EntityTransformer
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $availableIncludes = [
 | 
					    protected $availableIncludes = [
 | 
				
			||||||
        'client',
 | 
					        'client',
 | 
				
			||||||
 | 
					        'project',
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct(Account $account)
 | 
					    public function __construct(Account $account)
 | 
				
			||||||
@ -36,6 +37,17 @@ class TaskTransformer extends EntityTransformer
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function includeProject(Task $task)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ($task->project) {
 | 
				
			||||||
 | 
					            $transformer = new ProjectTransformer($this->account, $this->serializer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return $this->includeItem($task->project, $transformer, 'project');
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function transform(Task $task)
 | 
					    public function transform(Task $task)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return array_merge($this->getDefaults($task), [
 | 
					        return array_merge($this->getDefaults($task), [
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user