CorentinDav Posted January 8, 2015 Share Posted January 8, 2015 (edited) Bonjour, J'ai un module qui contient des overrides de controllers et classes. Quand j'installe ce module, fichiers sont crées dans le dossier /override, mais ils sont mal copiés, il manque des lignes ... Quelqu'un a t'il déjà eu ce problème ? Cordialement Edited January 8, 2015 by CorentinDav (see edit history) Link to comment Share on other sites More sharing options...
CorentinDav Posted January 8, 2015 Author Share Posted January 8, 2015 En gros j'ai : Dans le dossier du module, /override/classes/Country.php qui contient : <?php class Country extends CountryCore { public $reg_exp_cp; public static $definition = array( 'table' => 'country', 'primary' => 'id_country', 'multilang' => true, 'fields' => array( 'id_zone' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'call_prefix' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'iso_code' => array('type' => self::TYPE_STRING, 'validate' => 'isLanguageIsoCode', 'required' => true, 'size' => 3), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'contains_states' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_identification_number' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_zip_code' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'zip_code_format' => array('type' => self::TYPE_STRING, 'validate' => 'isZipCodeFormat'), 'reg_exp_cp' => array('type' => self::TYPE_STRING, 'size' => 100), 'display_tax_label' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), /* Lang fields */ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), ), 'associations' => array( 'zone' => array('type' => self::HAS_ONE), 'currency' => array('type' => self::HAS_ONE), ) ); } ?> J'installe le module, et dans le dossier override de la racine je me retrouve avec <?php class Country extends CountryCore { 'table' => 'country', 'primary' => 'id_country', 'multilang' => true, 'fields' => array( 'id_zone' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'call_prefix' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'iso_code' => array('type' => self::TYPE_STRING, 'validate' => 'isLanguageIsoCode', 'required' => true, 'size' => 3), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'contains_states' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_identification_number' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_zip_code' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'zip_code_format' => array('type' => self::TYPE_STRING, 'validate' => 'isZipCodeFormat'), 'reg_exp_cp' => array('type' => self::TYPE_STRING, 'size' => 100), 'display_tax_label' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), /* Lang fields */ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), ), 'associations' => array( 'zone' => array('type' => self::HAS_ONE), 'currency' => array('type' => self::HAS_ONE), ) ); } Link to comment Share on other sites More sharing options...
CorentinDav Posted January 8, 2015 Author Share Posted January 8, 2015 (edited) Dans la méthode addOverride de la classe module : <?php // same as precedent but for variable foreach ($module_class->getProperties() as $property){ $module_file = preg_replace('/(public|private|protected|const)\s+(static\s+)?(\$?'.$property->getName().')/ism', "\n\t/*\n\t* module: ".$this->name."\n\t* date: ".date('Y-m-d H:i:s')."\n\t* version: ".$this->version."\n\t*/\n$1 $2 $3" , $module_file); } Euh si je comprends bien, ça remplace l'attribut par un commentaire non ? ... Soit y'a un problème, soit l'override n'est pas fait pour ajouter des fonctionnalités ? Edited January 8, 2015 by CorentinDav (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now