public function format($entities) {
		$data = array(
			'models' => array(),
			'images' => array(),
			'links' => array()
		);

		if(! is_array($entities)) {
			$entities = array($entities->getId() => $entities);
		}

		foreach ($entities as $entity) {
			if($entity instanceof \Application\Togu\ApplicationModelsBundle\Document\Page) {
				foreach ($entity->getAllSections() as $section) {
					$entities[$section->getId()] = $section;
				}
			}
		}

		foreach ($entities as $entity) {
			$this->processor->getAllObjects($entity, $data['models']);
			$this->processor->getFieldValuesOfType($entity, 'image', $data['images']);
			$this->processor->getFieldValuesOfType($entity, 'link', $data['links']);
		}

		$this->convertLinks($data['links']);

		return $data;
	}
public function format($entities) {
		$data = array(
			'models' => array(),
			'images' => array(),
			'links' => array()
		);

		if(! is_array($entities)) {
			$entities = array($entities->getId() => $entities);
		}

		foreach ($entities as $entity) {
			if($entity instanceof \Application\Togu\ApplicationModelsBundle\Document\Page) {
				foreach ($entity->getAllSections() as $section) {
					$entities[$section->getId()] = $section;
				}
			}
		}

		foreach ($entities as $entity) {
			$this->processor->getAllObjects($entity, $data['models']);
			$this->processor->getFieldValuesOfType($entity, 'image', $data['images']);
			$this->processor->getFieldValuesOfType($entity, 'link', $data['links']);
		}

		$this->convertLinks($data['links']);

		return $data;
	}
public function format ( $ entities ) { $ data = array ( 'models' => array ( ) , 'images' => array ( ) , 'links' => array ( ) ) ; if ( ! is_array ( $ entities ) ) { $ entities = array ( $ entities -> getId ( ) => $ entities ) ; } foreach ( $ entities as $ entity ) { if ( $ entity instanceof \ Application \ Togu \ ApplicationModelsBundle \ Document \ Page ) { foreach ( $ entity -> getAllSections ( ) as $ section ) { $ entities [ $ section -> getId ( ) ] = $ section ; } } } foreach ( $ entities as $ entity ) { $ this -> processor -> getAllObjects ( $ entity , $ data [ 'models' ] ) ; $ this -> processor -> getFieldValuesOfType ( $ entity , 'image' , $ data [ 'images' ] ) ; $ this -> processor -> getFieldValuesOfType ( $ entity , 'link' , $ data [ 'links' ] ) ; } $ this -> convertLinks ( $ data [ 'links' ] ) ; return $ data ; }
Prepares the data to be serialized

@param mixed $entity The entity to serialize

@return string The serialized data
Prepares the data to be serialized