Controller/SocialMediaScheduleHandler.php
public function processContent(Operation $operation, $data)
    {
            if(is_array($data)) {
                // If the status has already been created, we modify its data.
                $status = $this->contentService->getSocialMediaScheduleByOperation($operation);
                // If data comes from API call, then Locations will not be
                // entities, but their IDs in an array.
                if(!$data['locations'] instanceof ArrayCollection){
                    $locations = $this->em
                        ->getRepository('CampaignChainCoreBundle:Location')
                        ->findById(array_values($data['locations']));
                    $locations = new ArrayCollection($locations);
                } else {
                    $locations = $data['locations'];
                }
                $status->setLocations($locations);
                $status->setMessage($data['message']);
            } else {
                $status = $data;
            }


        return $status;
    }
public function processContent(Operation $operation, $data)
    {
            if(is_array($data)) {
                // If the status has already been created, we modify its data.
                $status = $this->contentService->getSocialMediaScheduleByOperation($operation);
                // If data comes from API call, then Locations will not be
                // entities, but their IDs in an array.
                if(!$data['locations'] instanceof ArrayCollection){
                    $locations = $this->em
                        ->getRepository('CampaignChainCoreBundle:Location')
                        ->findById(array_values($data['locations']));
                    $locations = new ArrayCollection($locations);
                } else {
                    $locations = $data['locations'];
                }
                $status->setLocations($locations);
                $status->setMessage($data['message']);
            } else {
                $status = $data;
            }


        return $status;
    }
public function processContent ( Operation $ operation , $ data ) { if ( is_array ( $ data ) ) { // If the status has already been created, we modify its data. $ status = $ this -> contentService -> getSocialMediaScheduleByOperation ( $ operation ) ; // If data comes from API call, then Locations will not be // entities, but their IDs in an array. if ( ! $ data [ 'locations' ] instanceof ArrayCollection ) { $ locations = $ this -> em -> getRepository ( 'CampaignChainCoreBundle:Location' ) -> findById ( array_values ( $ data [ 'locations' ] ) ) ; $ locations = new ArrayCollection ( $ locations ) ; } else { $ locations = $ data [ 'locations' ] ; } $ status -> setLocations ( $ locations ) ; $ status -> setMessage ( $ data [ 'message' ] ) ; } else { $ status = $ data ; } return $ status ; }
Create or modify the Content object from the form data.

Called in these views:
- new
- editApi

@param Operation $operation
@param $data Form submit data of the Content.
@return mixed
Create or modify the Content object from the form data .