mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #12378 from mma/tests
Fixes #12376 bindTranslation restore fields
This commit is contained in:
commit
9f16d2e515
2 changed files with 11 additions and 1 deletions
|
@ -344,7 +344,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
public function afterFind(Model $Model, $results, $primary = false) {
|
||||
$Model->virtualFields = $this->runtime[$Model->alias]['virtualFields'];
|
||||
|
||||
$this->runtime[$Model->alias]['virtualFields'] = $this->runtime[$Model->alias]['fields'] = array();
|
||||
$this->runtime[$Model->alias]['virtualFields'] = array();
|
||||
if (!empty($this->runtime[$Model->alias]['restoreFields'])) {
|
||||
$this->runtime[$Model->alias]['fields'] = $this->runtime[$Model->alias]['restoreFields'];
|
||||
unset($this->runtime[$Model->alias]['restoreFields']);
|
||||
|
|
|
@ -1144,6 +1144,16 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$TestModel->bindTranslation($translations);
|
||||
|
||||
$result = $TestModel->find('first');
|
||||
$TestModel->find('first', array(
|
||||
'fields' => array(
|
||||
'TranslatedItem.title',
|
||||
),
|
||||
));
|
||||
$TestModel->find('first', array(
|
||||
'fields' => array(
|
||||
'TranslatedItem.title',
|
||||
),
|
||||
));
|
||||
$this->assertArrayHasKey('Title', $result);
|
||||
$this->assertArrayHasKey('content', $result['Title'][0]);
|
||||
$this->assertArrayNotHasKey('title', $result);
|
||||
|
|
Loading…
Reference in a new issue