public function save($data)
    {
        if (is_array($data)) {
            foreach ($data as $entity) {
                $this
                    ->manager
                    ->persist($entity);
            }
        } else {
            $this
                ->manager
                ->persist($data);
        }

        $this
            ->manager
            ->flush($data);

        return $data;
    }
public function save($data)
    {
        if (is_array($data)) {
            foreach ($data as $entity) {
                $this
                    ->manager
                    ->persist($entity);
            }
        } else {
            $this
                ->manager
                ->persist($data);
        }

        $this
            ->manager
            ->flush($data);

        return $data;
    }
public function save ( $ data ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ entity ) { $ this -> manager -> persist ( $ entity ) ; } } else { $ this -> manager -> persist ( $ data ) ; } $ this -> manager -> flush ( $ data ) ; return $ data ; }
Save the instance into database. Given data can be a single object or
an array of objects.

This method will persist and flush given object/array of objects

@param object|array $data Data to save into database

@return object|array Saved data
Save the instance into database . Given data can be a single object or an array of objects .