我目前正在使用Propel和我自己的框架,我试图实现验证模型而没有运气。
<?xml version="1.0" encoding="UTF-8"?>
<database name="framework" defaultIdMethod="native">
<table name="page" phpName="Page">
<!-- Columns -->
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
<column name="title" type="varchar" size="255" required="true" />
<column name="description" type="varchar" size="255" required="false" />
<column name="keywords" type="varchar" size="255" required="false" />
<column name="content" type="longvarchar" required="false" />
<column name="template_id" type="integer" required="false" />
<column name="publish_date" type="date" required="false" />
<!-- Validators -->
<behavior name="validate">
<parameter name="rule1" value="{column: title, validator: NotNull}" />
</behavior>
<!-- Behaviors -->
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, content" />
<parameter name="default_locale" value="en_GB" />
</behavior>
<behavior name="nested_set" />
<behavior name="sluggable" />
<behavior name="sortable" />
<behavior name="timestampable" />
<!-- Foreign Keys -->
<foreign-key foreignTable="page_template">
<reference local="template_id" foreign="id"/>
</foreign-key>
</table>
</database>
针对上述架构运行model:build
时,特别是包含以下节点:
<!-- Validators -->
<behavior name="validate">
<parameter name="rule1" value="{column: title, validator: NotNull}" />
</behavior>
它返回:
[Propel\Generator\Exception\InvalidArgumentException]
Please, define the validator constraint.
但是如您所见,验证器属性已设置。
如果我删除了验证行为,它可以正常工作。
有没有人遇到过这个问题?
干杯
GAV株系