mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
mvc: "make validate" was not validating the full model...
... which was the intention of this helper. Now, we see a lot of
other things that need fixing, but there is an implication for
migrations ("make migrate") where the copy of that function came
from... Apparenlty migration only validates the model changes done
during migration, which is fine, but if we are restricting validation
further during a migration and forget to change these fields they are
not marked for validation and thus "validate" "correctly" leaving them
in a broken state in the config. This can be cross-checked by the
GUI attempting to save these faulty values which is then no longer
possible. Needs more discussion.
This commit is contained in:
parent
cacca97a1c
commit
3200c0ba85
@ -507,10 +507,10 @@ abstract class BaseModel
|
||||
* @param string $targetref target reference, for example section. used as prefix if no source given
|
||||
* @return array list of validation errors, indexed by field reference
|
||||
*/
|
||||
public function validate($sourceref = null, $targetref = "")
|
||||
public function validate($sourceref = null, $targetref = '', $validateFullModel = false)
|
||||
{
|
||||
$result = array();
|
||||
$valMsgs = $this->performValidation();
|
||||
$result = [];
|
||||
$valMsgs = $this->performValidation($validateFullModel);
|
||||
foreach ($valMsgs as $msg) {
|
||||
// replace absolute path to attribute for relative one at uuid.
|
||||
if ($sourceref != null) {
|
||||
|
||||
@ -50,7 +50,7 @@ foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($model_dir
|
||||
$name = $mdl_class_info->getName();
|
||||
$mdl = $mdl_class_info->newInstance();
|
||||
if (!$mdl->isVolatile()) {
|
||||
$msgs = $mdl->validate();
|
||||
$msgs = $mdl->validate(null, '', true);
|
||||
foreach ($msgs as $key => $msg) {
|
||||
echo sprintf('%s.%s => %s', $name, $key, $msg) . PHP_EOL;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user