Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
2012.1, 4.6.0
-
None
Description
heavily related to http://issues.ez.no/IssueView.php?Id=19165.
imho, createAndPublishObject should work the same way as content/edit, content/action does in terms in validation. i'll try to explain with an example.
suppose you have a class called "strings" with two attributes (let's call them string1, string2). both are required
now try to create a cotnentobject of this class, but provide only an entry for string1. ez publish will tell you he is expecting for an entry in string2 too, what is quite logical.
now try to do the same with createAndPublishObject method. suppose $params['attributeList'] is just this array
$params['attributeList'] = array( 'string1' => 'hello' );
in this case, createAndPublishObject will publish the object without any warning or error at all.
as i said in that related issue, it should be cool fromString validates entries, but the problem here is because string2 is not provided at all, so nothing to validate here.
so, i think we should work on this:
1) modifying createAndPublishObject method to check at least all required data is provided
this can be as simple as adding an else...
foreach( $attributes as $attribute ) { $attributeIdentifier = $attribute->attribute( 'contentclass_attribute_identifier' ); if ( isset( $attributesData[$attributeIdentifier] ) ) { .... } elseif( $attribute->isRequired() ) return false and grab something in the log.
2) add those validations to every fromString method.
thoughts?
Steps to reproduce
see summary