Skip to main content
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

EditEdit: After you edited a composer.json file, run composer dump-autoload to update the autoloader.

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

Edit: After you edited a composer.json file, run composer dump-autoload to update the autoloader.

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

Edit: After you edited a composer.json file, run composer dump-autoload to update the autoloader.

Added your comment to the end of your post because of its importance.
Source Link

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

Edit: After you edited a composer.json file, run composer dump-autoload to update the autoloader.

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}

Edit: After you edited a composer.json file, run composer dump-autoload to update the autoloader.

Source Link
Fabian Schmengler
  • 66.1k
  • 25
  • 188
  • 422

There is no "local code pool override" mechanism anymore. Instead you can use preferences in di.xml for any class that is instantiated by the Magento object manager, i.e. used via Dependency Injection in Magento classes. This is the equivalent to a class rewrite in Magento 1.

But for classes like Zend_Date where this is not the case, this is not possible.

However you could create a composer package that loads your own Zend_Date class before the real one is loaded via autoloading:

composer.json

{
    "name": "your/custom-date",
    "autoload": {
      "files": ["src/lib/Zend/Date.php"]
    }
}

src/lib/Zend/Date.php

class Zend_Date
{
    ...
}