Skip to content

Commit af863de

Browse files
Merge pull request #9 from yxie/master
Fixing various bugs during use of the bundle
2 parents 284abb3 + 8946e1e commit af863de

5 files changed

Lines changed: 24 additions & 5 deletions

File tree

Command/ImportCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ function ($translation) use ($locale) {
151151
}
152152
}
153153

154-
$storage->flushAll();
154+
$storage->flush();
155+
$storage->clear();
155156

156157
$this->output->writeln('<info>DONE</info>');
157158
}

Controller/EditorController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ public function addTranslationAction()
136136
$storageService->createTranslation($locale, $entry, $translationValue);
137137
}
138138

139+
$storageService->flush();
140+
139141
// Return reponse according to request type
140142
if ( ! $request->isXmlHttpRequest()) {
141143
return new RedirectResponse($this->generateUrl('sg_localeditor_index'));
@@ -183,6 +185,8 @@ public function updateTranslationAction()
183185
$storageService->createTranslation($locale, $entry, $value);
184186
}
185187

188+
$storageService->flush();
189+
186190
$result = array(
187191
'result' => true,
188192
'message' => 'Translation updated successfully.'
@@ -253,6 +257,8 @@ public function addLocaleAction()
253257
// Create new Locale
254258
$storageService->createLocale($language, $country);
255259

260+
$storageService->flush();
261+
256262
$result = array(
257263
'result' => true,
258264
'message' => 'New locale added successfully. Reload list for completion.'

Resources/views/layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
$(document).ready(function () {
9494
$('#locales input').click(function(e) {
9595
var li = $(e.target).parent();
96-
confirm('Are you sure?') && removeLocale(li.data('id'), li.data('index'));
96+
confirm('Are you sure?') && removeLocale(li.data('index'), li.data('id'));
9797
});
9898
$('#nav-new-locale').click(function() {
9999
$('.alert-message').hide();

Storage/AbstractStorage.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,16 @@ public function persist($entity)
109109
/**
110110
* {@inheritdoc}
111111
*/
112-
public function flushAll()
112+
public function flush()
113113
{
114114
$this->manager->flush();
115+
}
116+
117+
/**
118+
* {@inheritdoc}
119+
*/
120+
public function clear()
121+
{
115122
$this->manager->clear();
116123
}
117124

Storage/StorageInterface.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ public function deleteTranslation($id);
106106
public function persist($entity);
107107

108108
/**
109-
* Flushes all persisted entities, and clear the object manager
109+
* Flushes all persisted entities
110110
*/
111-
public function flushAll();
111+
public function flush();
112+
113+
/**
114+
* Clear all managed entities in the object manager
115+
*/
116+
public function clear();
112117
}

0 commit comments

Comments
 (0)