Closed thiagocamposviana closed 10 years ago
I don't get it, you can still use something like this, right?
https://gist.github.com/emodric/51d11c8f92ff0a1fc648
eddie@abyss: ~ $ php sort_test.php
array(4) {
[0] =>
class Test#4 (1) {
public $id =>
int(2)
}
[1] =>
class Test#2 (1) {
public $id =>
int(4)
}
[2] =>
class Test#5 (1) {
public $id =>
int(7)
}
[3] =>
class Test#3 (1) {
public $id =>
int(13)
}
}
Let me try something
Fixed, now looks like this:
function tags()
{
if ( !is_array( $this->IDArray ) || empty( $this->IDArray ) )
return array();
$eztags = array();
foreach( eZTagsObject::fetchList( array( 'id' => array( $this->IDArray ) ) ) as $item)
{
$eztags[array_search($item->attribute('id'), $this->IDArray)] = $item;
}
ksort($eztags);
if(count($eztags) > 0)
return $eztags;
return null;
}
I have fixed the code, for the js file I completely replaced \t (tabs) with 4 white spaces ( ), and also removed trailing spaces.
Hi @thiagocamposviana
I have just two more comments and then I'm merging this :)
OK, this is now good :) Give me some more time to test this again, and I'll merge it sometime tomorrow!
Great work @thiagocamposviana :+1:
Okay, I think this is ready for merging. Is there anything you wish to add @thiagocamposviana?
Also, I'm gonna try to port this to multilanguage
branch. Can I ping you if I'm stuck?
I forgot to mention, can you please create a mysql upgrade script in update/database/mysql/1.4/eztags-dbupdate-1.3-to-1.4.sql
?
Something like this:
ALTER TABLE `eztags_attribute_link`
ADD COLUMN `priority` int(11) NOT NULL default 0 AFTER `object_id`;
Ok, created the upgrade sql query.
Happy to help if needed on getting this onto the multilanguage branch!
Thanks @thiagocamposviana, merging it now!
Last time I checked eZTagsObject::fetchList( ) receives one array of object ids, but the array returned will not follow the objects id order we have passed, this is why I fetch one by one.