Ejemplo n.º 1
0
 /**
  * Правило на атрибуты
  * @return Rule
  */
 protected function rule()
 {
     return Rule::arrays(['name' => Rule::string()->regexp('|^[^/@:#\\\\]*$|')->min(IS_INSTALL ? 1 : 0)->max(100)->required(), 'parent' => Rule::any(Rule::uri(), Rule::null()), 'proto' => Rule::any(Rule::uri(), Rule::null()), 'author' => Rule::any(Rule::uri(), Rule::null()), 'order' => Rule::int()->max(Entity::MAX_ORDER), 'created' => Rule::int(), 'updated' => Rule::int(), 'value' => Rule::string()->max(65535), 'is_draft' => Rule::bool(), 'is_hidden' => Rule::bool(), 'is_mandatory' => Rule::bool(), 'is_property' => Rule::bool(), 'is_relative' => Rule::bool(), 'is_link' => Rule::bool(), 'is_default_value' => Rule::bool(), 'is_default_file' => Rule::bool(), 'is_default_logic' => Rule::bool(), 'file' => Rule::any([Rule::null(), Rule::string()->regexp('/[^\\/\\\\]+/ui'), Rule::arrays(['tmp_name' => Rule::string(), 'name' => Rule::lowercase()->ospatterns('*.*')->ignore('lowercase')->required(), 'size' => Rule::int(), 'error' => Rule::int()->eq(0, true), 'type' => Rule::string()])])]);
 }