Clarification Regarding View Assignment Changes in Update to Version 5.6.2

04.05.2025 17:52
#1
msin
Joomshopping forum user no avatar
Name: Marcel Singer
17.05.2012
Сообщения: 51
Quote
Clarification Regarding View Assignment Changes in Update to Version 5.6.2

Dear Team

I have noticed that in version 5.6.2 of CartController.php, several view assignments that previously used the method $view->set() have been replaced with direct property assignments, such as $view->weight = $cartpreview->getWeight();.

In earlier versions, including 5.5.2 and 5.6.1, the $view->set() method was still consistently used.

Could you kindly confirm whether this change was intentional? From the perspective of Joomla best practices, using the set() method is generally recommended for consistency, flexibility, and future compatibility.

It appears that this may have been a regression, but I would appreciate your clarification in case there was a specific reason behind the adjustment.

Thank you in advance for your feedback.

Best regards,

 
04.05.2025 20:21
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 28003
Quote
Aw: Clarification Regarding View Assignment Changes in Update to Version 5.6.2

set is deprecated

class HtmlView extends AbstractView

abstract class AbstractView...
use LegacyPropertyManagementTrait


/**
* Trait which contains the legacy methods that formerly were inherited from \Joomla\CMS\Object\CMSObject to set and
* get properties of the current class.
*
* @since 4.3.0
*
* @deprecated 4.3.0 will be removed in 6.0
* Will be removed without replacement
* Create proper setter functions for the individual properties or use a \Joomla\Registry\Registry
*/
trait LegacyPropertyManagementTrait {

/**
* Modifies a property of the object, creating it if it does not already exist.
*
* @param string $property The name of the property.
* @param mixed $value The value of the property to set.
*
* @return mixed Previous value of the property.
*
* @since 1.7.0
*
* @deprecated 4.3.0 will be removed in 6.0
* Create a proper setter function for the property
*/
public function set($property, $value = null)
{
$previous = $this->$property ?? null;
$this->$property = $value;

return $previous;
}
}

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.