Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
Merge branch 'trunk' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matsuo committed Oct 3, 2012
2 parents 35bf5d6 + bc06170 commit 5786045
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
26 changes: 20 additions & 6 deletions Filemaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,15 @@ public function create(&$model, $fields = null, $values = null) {
}

foreach($fields as $index => $field) {
$this->connection->AddDBParam($field, $values[$index]);
if (is_array($values[$index])) {
$this->connection->AddDBParam($field, implode("\r", $values[$index]));
} else {
if (function_exists("mb_ereg_replace")) {
$this->connection->AddDBParam($field, mb_ereg_replace("\n", "\r" , mb_ereg_replace("\r\n", "\r" , $values[$index])));
} else {
$this->connection->AddDBParam($field, str_replace("\n", "\r", str_replace("\r\n", "\r" ,$values[$index])));
}
}
}

// perform creation
Expand Down Expand Up @@ -518,9 +526,13 @@ public function update(Model $model, $fields = array(), $values = null, $conditi
$model->setInsertID($values[$index]);
}
if (is_array($values[$index])) {
$this->connection->AddDBParam($field, implode("\r\n", $values[$index]));
$this->connection->AddDBParam($field, implode("\r", $values[$index]));
} else {
$this->connection->AddDBParam($field, $values[$index]);
if (function_exists("mb_ereg_replace")) {
$this->connection->AddDBParam($field, mb_ereg_replace("\n", "\r" , mb_ereg_replace("\r\n", "\r" , $values[$index])));
} else {
$this->connection->AddDBParam($field, str_replace("\n", "\r", str_replace("\r\n", "\r" ,$values[$index])));
}
}
}

Expand Down Expand Up @@ -726,9 +738,11 @@ public function queryAssociation(& $model, & $linkModel, $type, $association, $a

$associatedData = $this->readAssociated($linkModel, $queryData, 0);

foreach($associatedData as $assocIndex => $relatedModel) {
$modelName = key($relatedModel);
$resultSet[$projIndex][$modelName][$assocIndex] = $relatedModel[$modelName];
if (is_array($associatedData)) {
foreach($associatedData as $assocIndex => $relatedModel) {
$modelName = key($relatedModel);
$resultSet[$projIndex][$modelName][$assocIndex] = $relatedModel[$modelName];
}
}
}
}
Expand Down
Binary file modified User Guide (Japanese).pdf
Binary file not shown.
Binary file modified User Guide.pdf
Binary file not shown.
9 changes: 6 additions & 3 deletions unit_testing/Case/Model/Datasource/Database/FilemakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,16 @@ public function testCreateUpdate() {
$model =& new TestArticle();
$_data = array(
'TestArticle' => array(
'Title' => 'UT CU Title',
'Body' => 'UT CU Body'
'Title' => 'UT CU Title' . "\r\n" . 'UT CU Title Line 2' . "\n" . 'UT CU Title Line 3' . "\r" . 'UT CU Title Line 4',
'Body' => array('UT CU Body', 'UT CU Body 2')
)
);
$model->create();
$saveResult = $model->save($_data);

$this->assertEqual($saveResult['TestArticle']['Title'], 'UT CU Title' . "\n" . 'UT CU Title Line 2' . "\n" . 'UT CU Title Line 3' . "\n" . 'UT CU Title Line 4');
$this->assertEqual($saveResult['TestArticle']['Body'], 'UT CU Body' . "\n" . 'UT CU Body 2');

$primaryKeyID = $model->id;

$_data = array(
Expand All @@ -522,7 +525,7 @@ public function testCreateUpdate() {
$this->assertEqual($saveResult['TestArticle']['-recid'], $findResult['TestArticle']['-recid']);
$this->assertEqual($findResult['TestArticle']['id'], $primaryKeyID);
$this->assertEqual($findResult['TestArticle']['Title'], 'UT CU Title Updated');
$this->assertEqual($findResult['TestArticle']['Body'], 'UT CU Body Updated' . PHP_EOL . 'UT CU Body Updated2');
$this->assertEqual($findResult['TestArticle']['Body'], 'UT CU Body Updated' . "\n" . 'UT CU Body Updated2');
}

/**
Expand Down

0 comments on commit 5786045

Please sign in to comment.