View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Validate_Callback
{zone-data}

{zone-data:proposer-list}
[~thomas]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 25 April 2009: Initial proposal
{zone-data}

{zone-data:overview}
Zend_Validate_Callback is a validator which allows to use any self written method as validator.
{zone-data}

{zone-data:references}
* [Zend_Validate|http://framework.zend.com/manual/en/zend.validate.html]
* [http://framework.zend.com/issues/browse/ZF-2268]
{zone-data}

{zone-data:requirements}
* This component *will* call any userland method as validator
{zone-data}

{zone-data:dependencies}
* Zend_Validate
{zone-data}

{zone-data:operation}
This component allows to use userland methods as validator which are called by using a callback.
{zone-data}

{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal finished
* Milestone 2: \[DONE\] Proposal accepted
* Milestone 3: \[DONE\] Working implementation
* Milestone 4: \[DONE\] Unit tests
* Milestone 5: \[DONE\] Documentation
* Milestone 6: \[DONE\] Moved to core
{zone-data}

{zone-data:class-list}
* Zend_Validate_Callback
{zone-data}

{zone-data:use-cases}
||UC-01||
Add a callback
{code}
function mymethod($param) {}

$validator = new Zend_Validator_Callback('mymethod');

$valid = $validator->isValid('input);
{code}
||UC-02||
Add a callback for a class method
{code}
class myclass
{
function mymethod($param) {}
}

$validator = new Zend_Validator_Callback(array('myclass', 'mymethod'));

$valid = $validator->isValid('input);
{code}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Validate_Callback extends Zend_Validate_Abstract
{
public function isValid($input)
{}
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>