public function save(Indexation $index)
    {
        $existing = $this->find([
            '_content' => $index->getContent(),
            '_field' => $index->getField(),
        ]);

        if (null === $existing) {
            $existing = $index;
            $this->getEntityManager()->persist($existing);
        } else {
            $existing->setValue($index->getValue());
        }

        $metadata = $this->getEntityManager()->getClassMetadata('BackBee\ClassContent\Indexation');
        $this->getEntityManager()
                ->getUnitOfWork()
                ->computeChangeSet($metadata, $existing);
    }
public function save(Indexation $index)
    {
        $existing = $this->find([
            '_content' => $index->getContent(),
            '_field' => $index->getField(),
        ]);

        if (null === $existing) {
            $existing = $index;
            $this->getEntityManager()->persist($existing);
        } else {
            $existing->setValue($index->getValue());
        }

        $metadata = $this->getEntityManager()->getClassMetadata('BackBee\ClassContent\Indexation');
        $this->getEntityManager()
                ->getUnitOfWork()
                ->computeChangeSet($metadata, $existing);
    }
public function save ( Indexation $ index ) { $ existing = $ this -> find ( [ '_content' => $ index -> getContent ( ) , '_field' => $ index -> getField ( ) , ] ) ; if ( null === $ existing ) { $ existing = $ index ; $ this -> getEntityManager ( ) -> persist ( $ existing ) ; } else { $ existing -> setValue ( $ index -> getValue ( ) ) ; } $ metadata = $ this -> getEntityManager ( ) -> getClassMetadata ( 'BackBee\ClassContent\Indexation' ) ; $ this -> getEntityManager ( ) -> getUnitOfWork ( ) -> computeChangeSet ( $ metadata , $ existing ) ; }
Saves an indexation entity, persists it first if need.

@param Indexation $index The indexation entity to save.
Saves an indexation entity persists it first if need .