Jump to content

Node::load() but with custom column name instead of id


Go to solution Solved by CodePixel,

Recommended Posts

  • Solution

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 by CodePixel
Link to comment
Share on other sites

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 by CodePixel
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...