Jump to content

Override class and add class variable


Recommended Posts

Hi,

 

I've created module and i put there override class Address. What i want is add new variable to class definition after i add manually column to database address table. File location is: /module/integrator/override/classes/Address.php.

 

Address.php

<?php

class Address extends AddressCore{
  public $id_integrator_address;

  public function __construct($id_address = null, $id_lang = null)
  {
      parent::__construct($id_address);

      $this->$definition = array_merge($this->definition['fields'], array('id_integrator_address' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt')));
  }
}

Error:

Accessing static property Address::$definition as non static

 

I have no idea how to merge my new variable with class definition. It needs to be in my module, i don't want to make any changes on core files.

Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...