CodePixel Posted March 29 Share Posted March 29 Hello, is there a way to load a Node by column_name instead of by id like it is by default? Link to comment Share on other sites More sharing options...
Solution CodePixel Posted March 30 Author Solution Share Posted March 30 (edited) Update: yes it's possible by doing this: #1: Add this to your Node class: /** * @brief [ActiveRecord] Database ID Fields * @note If using this, declare a static $multitonMap = array(); in the child class to prevent duplicate loading queries */ protected static $databaseIdFields = array('column_name'); #2: then load node row by custom column like so \IPS\yourapp\class\class::load($id, 'column_name'); Edited March 30 by CodePixel Martin A. 1 Link to comment Share on other sites More sharing options...
Adriano Faria Posted March 30 Share Posted March 30 You shouldn’t replace the ID by the “name”. You should allow both: array( ‘id’, 'column_name'); and call the node using the name, like; ……load( ‘bla bla bla’, ‘column_name’ ); That’s the same case when you load a member by name or email. Link to comment Share on other sites More sharing options...
CodePixel Posted March 30 Author Share Posted March 30 (edited) Just now, Adriano Faria said: You shouldn’t replace the ID by the “name”. You should allow both: array( ‘id’, 'column_name'); and call the node using the name, like; ……load( ‘bla bla bla’, ‘column_name’ ); That’s the same case when you load a member by name or email. That's good to know, not needed in my case but still, thank you! Edited March 30 by CodePixel Link to comment Share on other sites More sharing options...
Recommended Posts