src/Entity/XiboCampaign.php
public function assignLayout($layoutId = [], $displayOrder = [], $unassignLayoutId = [])
    {
        // TODO Check if $layoutId and $displayOrderId have the same length, throw error otherwise

        if ($layoutId != [] && $unassignLayoutId == []) {
            for ($i = 0; $i < count($layoutId); $i++) {
                $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                    'layoutId' => [
                        [
                            'layoutId' => $layoutId[$i],
                            'displayOrder' => $displayOrder[$i]
                        ]
                    ]
                ]);
                $this->getLogger()->info('Assigning Layout ID ' . $layoutId[$i] . ' To Campaign ID ' . $this->campaignId);
            }
        } elseif ($layoutId != [] && $unassignLayoutId != []) {
            for ($i = 0; $i < count($layoutId); $i++) {
                for ($j = 0; $j < count($unassignLayoutId); $j++) {
                    $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                        'layoutId' => [
                            [
                                'layoutId' => $layoutId[$i],
                                'displayOrder' => $displayOrder[$i]
                            ]
                        ],
                        'unassignLayoutId' => [
                            [
                                'layoutId' => $unassignLayoutId[$j],
                            ]
                        ]
                    ]);
                    $this->getLogger()->info('Assigning Layout ID ' . $layoutId[$i] . ' To Campaign ID ' . $this->campaignId);
                    $this->getLogger()->info('Removing assignment Layout ID ' . $unassignLayoutId[$j] . ' From Campaign ID ' . $this->campaignId);
                }
            }
        } elseif ($layoutId == [] && $unassignLayoutId != []) {
            for ($j = 0; $j < count($unassignLayoutId); $j++) {
                $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                    'unassignLayoutId' => [
                        [
                            'layoutId' => $unassignLayoutId[$j],
                        ]
                    ]
                ]);
                $this->getLogger()->info('Removing assignment Layout ID ' . $unassignLayoutId[$j] . ' From Campaign ID ' . $this->campaignId);
            }
        }

        // TODO Throw an error if nothing is passed / found

        return $this;
    }
public function assignLayout($layoutId = [], $displayOrder = [], $unassignLayoutId = [])
    {
        // TODO Check if $layoutId and $displayOrderId have the same length, throw error otherwise

        if ($layoutId != [] && $unassignLayoutId == []) {
            for ($i = 0; $i < count($layoutId); $i++) {
                $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                    'layoutId' => [
                        [
                            'layoutId' => $layoutId[$i],
                            'displayOrder' => $displayOrder[$i]
                        ]
                    ]
                ]);
                $this->getLogger()->info('Assigning Layout ID ' . $layoutId[$i] . ' To Campaign ID ' . $this->campaignId);
            }
        } elseif ($layoutId != [] && $unassignLayoutId != []) {
            for ($i = 0; $i < count($layoutId); $i++) {
                for ($j = 0; $j < count($unassignLayoutId); $j++) {
                    $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                        'layoutId' => [
                            [
                                'layoutId' => $layoutId[$i],
                                'displayOrder' => $displayOrder[$i]
                            ]
                        ],
                        'unassignLayoutId' => [
                            [
                                'layoutId' => $unassignLayoutId[$j],
                            ]
                        ]
                    ]);
                    $this->getLogger()->info('Assigning Layout ID ' . $layoutId[$i] . ' To Campaign ID ' . $this->campaignId);
                    $this->getLogger()->info('Removing assignment Layout ID ' . $unassignLayoutId[$j] . ' From Campaign ID ' . $this->campaignId);
                }
            }
        } elseif ($layoutId == [] && $unassignLayoutId != []) {
            for ($j = 0; $j < count($unassignLayoutId); $j++) {
                $response = $this->doPost('/campaign/layout/assign/' . $this->campaignId, [
                    'unassignLayoutId' => [
                        [
                            'layoutId' => $unassignLayoutId[$j],
                        ]
                    ]
                ]);
                $this->getLogger()->info('Removing assignment Layout ID ' . $unassignLayoutId[$j] . ' From Campaign ID ' . $this->campaignId);
            }
        }

        // TODO Throw an error if nothing is passed / found

        return $this;
    }
public function assignLayout ( $ layoutId = [ ] , $ displayOrder = [ ] , $ unassignLayoutId = [ ] ) { // TODO Check if $layoutId and $displayOrderId have the same length, throw error otherwise if ( $ layoutId != [ ] && $ unassignLayoutId == [ ] ) { for ( $ i = 0 ; $ i < count ( $ layoutId ) ; $ i ++ ) { $ response = $ this -> doPost ( '/campaign/layout/assign/' . $ this -> campaignId , [ 'layoutId' => [ [ 'layoutId' => $ layoutId [ $ i ] , 'displayOrder' => $ displayOrder [ $ i ] ] ] ] ) ; $ this -> getLogger ( ) -> info ( 'Assigning Layout ID ' . $ layoutId [ $ i ] . ' To Campaign ID ' . $ this -> campaignId ) ; } } elseif ( $ layoutId != [ ] && $ unassignLayoutId != [ ] ) { for ( $ i = 0 ; $ i < count ( $ layoutId ) ; $ i ++ ) { for ( $ j = 0 ; $ j < count ( $ unassignLayoutId ) ; $ j ++ ) { $ response = $ this -> doPost ( '/campaign/layout/assign/' . $ this -> campaignId , [ 'layoutId' => [ [ 'layoutId' => $ layoutId [ $ i ] , 'displayOrder' => $ displayOrder [ $ i ] ] ] , 'unassignLayoutId' => [ [ 'layoutId' => $ unassignLayoutId [ $ j ] , ] ] ] ) ; $ this -> getLogger ( ) -> info ( 'Assigning Layout ID ' . $ layoutId [ $ i ] . ' To Campaign ID ' . $ this -> campaignId ) ; $ this -> getLogger ( ) -> info ( 'Removing assignment Layout ID ' . $ unassignLayoutId [ $ j ] . ' From Campaign ID ' . $ this -> campaignId ) ; } } } elseif ( $ layoutId == [ ] && $ unassignLayoutId != [ ] ) { for ( $ j = 0 ; $ j < count ( $ unassignLayoutId ) ; $ j ++ ) { $ response = $ this -> doPost ( '/campaign/layout/assign/' . $ this -> campaignId , [ 'unassignLayoutId' => [ [ 'layoutId' => $ unassignLayoutId [ $ j ] , ] ] ] ) ; $ this -> getLogger ( ) -> info ( 'Removing assignment Layout ID ' . $ unassignLayoutId [ $ j ] . ' From Campaign ID ' . $ this -> campaignId ) ; } } // TODO Throw an error if nothing is passed / found return $ this ; }
Assign layout to the campaign.

@param array $layoutId Array of layouts Ids to assign to this campaign
@param array $displayOrder Array of Display Order numbers for the layouts to assign
@param array $unassignLayoutId Array of layouts Ids to unassign from the campaign
@return XiboCampaign
Assign layout to the campaign .