mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
09e7f1d491
commit
85b86cb282
2 changed files with 13 additions and 10 deletions
|
@ -285,6 +285,10 @@ class HelperTest extends CakeTestCase {
|
||||||
$expected = array('HelperTestComment', 'id', 'time');
|
$expected = array('HelperTestComment', 'id', 'time');
|
||||||
$this->assertEquals($expected, $this->Helper->entity());
|
$this->assertEquals($expected, $this->Helper->entity());
|
||||||
|
|
||||||
|
$this->Helper->setEntity('HelperTestComment.created.year');
|
||||||
|
$expected = array('HelperTestComment', 'created', 'year');
|
||||||
|
$this->assertEquals($expected, $this->Helper->entity());
|
||||||
|
|
||||||
$this->Helper->setEntity(null);
|
$this->Helper->setEntity(null);
|
||||||
$this->Helper->setEntity('ModelThatDoesntExist.field_that_doesnt_exist');
|
$this->Helper->setEntity('ModelThatDoesntExist.field_that_doesnt_exist');
|
||||||
$expected = array('ModelThatDoesntExist', 'field_that_doesnt_exist');
|
$expected = array('ModelThatDoesntExist', 'field_that_doesnt_exist');
|
||||||
|
|
|
@ -433,21 +433,20 @@ class Helper extends Object {
|
||||||
|
|
||||||
// Either 'body' or 'date.month' type inputs.
|
// Either 'body' or 'date.month' type inputs.
|
||||||
if (
|
if (
|
||||||
($count === 1 &&
|
($count === 1 && $this->_modelScope && $setScope == false) ||
|
||||||
$this->_modelScope &&
|
(
|
||||||
$setScope == false) ||
|
$count === 2 &&
|
||||||
(in_array($lastPart, $this->_fieldSuffixes) &&
|
in_array($lastPart, $this->_fieldSuffixes) &&
|
||||||
$this->_modelScope &&
|
$this->_modelScope &&
|
||||||
$parts[0] !== $this->_modelScope)
|
$parts[0] !== $this->_modelScope
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$entity = $this->_modelScope . '.' . $entity;
|
$entity = $this->_modelScope . '.' . $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.name style inputs.
|
// 0.name, 0.created.month style inputs.
|
||||||
if (
|
if (
|
||||||
$count === 2 &&
|
$count >= 2 && is_numeric($parts[0]) && !is_numeric($parts[1]) && $this->_modelScope
|
||||||
is_numeric($parts[0]) &&
|
|
||||||
!is_numeric($parts[1])
|
|
||||||
) {
|
) {
|
||||||
$entity = $this->_modelScope . '.' . $entity;
|
$entity = $this->_modelScope . '.' . $entity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue