Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - Override Doctrine_Record validate method with a Doctrine_Template -


in symfony project use new strategy manage data form.

i don't want use symfony form object, want use model build them.

i don't want redeclare base doctrine_record class, wrote new doctrine_template: extendedmodel.

in extendemodel template i've new objects , methods, need override validate() function of doctrine_record.

i tried with

class extendedmodel extends doctrine_template {  [...]  public $validatorschema;  public function setvalidatorschema(sfvalidatorschema $validatorschema) {     $this->validatorschema = $validatorschema; }  public function getvalidatorschema() {     return $this->validatorschema; }  public function validate() {     $this->getinvoker()->setup();      $errorstack = $this->getinvoker()->geterrorstack();     if ($this->getvalidatorschema()) {         try {             $this->getvalidatorschema()->addoption('allow_extra_fields', true);             $this->getvalidatorschema()->clean($this->getinvoker()->toarray(false));         } catch (sfvalidatorerrorschema $errorschema) {             $errorstack = $this->getinvoker()->geterrorstack();             foreach ($errorschema->geterrors() $key => $error) {                 /* @var $error sfvalidatorerror  */                 $errorstack->add($key, $error->getmessage());             }         }     }     $this->getinvoker()->validate(); }  } 

but doctrine use original validate() function.

i want override doctrine_record functions new methods declared doctrine_template.

could suggest me solution problem?

tnx!

templates not override doctrine_record methods, fallbacks invoked via php magic __call method when native method isn't found.

to this, need have own class in doctrine_record inheritance chain. fortunately, pretty easy:

1. create mydoctrinerecord

abstract class mydoctrinerecord extends sfdoctrinerecord {    public function commonrecordmethod() { } } 

i place file in lib/record, can put anywhere autoloader see it.

2. set symfony use class in configuredoctrine callback of projectconfiguration:

public function configuredoctrine(doctrine_manager $manager) {    sfconfig::set('doctrine_model_builder_options', array('baseclassname' => 'mydoctrinerecord')); } 

this copied/pasted previous answer similar question. you'll have rebuild model well.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -