Categories > TinyButStrong general >

TBS auto merge object array

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: cerede2000
Date: 2013-04-23
Time: 17:13

TBS auto merge object array

Hello,

I have an array wich contain Objects.
I would like make this :

$contacts = $annuaire->getContactsList();
$TBS->MergeBlock('tablevalblk','????', 'contacts');

$TBS->Show();

Where $contacts is:
$contacts[0] => ObjContact0
$contacts[1] => ObjContact1
$contacts[2] => ObjContact2
...
$contacts[X] => ObjContactX

How make this :)

Thank you.
By: Skrol29
Date: 2013-04-23
Time: 17:36

Re: TBS auto merge object array

Hi,

This should work:
$contacts = $annuaire->getContactsList();
$TBS->MergeBlock('tablevalblk', $contacts);
By: cerede2000
Date: 2013-04-23
Time: 17:46

Re: TBS auto merge object array

And after I can call object method ?

Like :
[tablevalblk.ObjGetAttribute] ?
By: cerede2000
Date: 2013-04-24
Time: 10:26

Re: TBS auto merge object array

This code not work :(
$contacts = $annuaire->getContactsList();
$TBS->MergeBlock('tablevalblk', $contacts);
I have error : TinyButStrong Error when merging block [Array] : Data source Id 'contacts' is unsupported because function 'tbsdb_contacts_open' is not found.
By: Skrol29
Date: 2013-04-24
Time: 10:42

Re: TBS auto merge object array

Hi,

You have the error message "Data source Id 'contacts' is unsupported because function 'tbsdb_contacts_open' is not found."
because $contacts is an object, not a PHP array.

Try to convert $contacts as a true PHP Array containing objects (of any class). TBS natively support also ArrayObject, Iterator, and  IteratorAggregate.
Otherwise you have to code your small plug-in for reading record in the data source.

By: Skrol29
Date: 2013-04-24
Time: 10:44

Re: TBS auto merge object array

> And after I can call object method ?
> [tablevalblk.ObjGetAttribute] ?

Yes.
By: Skrol29
Date: 2013-04-24
Time: 11:28

Re: TBS auto merge object array

Check that your code is actually
$TBS->MergeBlock('tablevalblk', $contacts);
and not
$TBS->MergeBlock('tablevalblk', 'contacts');

If you have no mistake with this line, please send to a small code to reproduce the problem because I cant' see why you may have this message if you are merging an array.
By: cerede2000
Date: 2013-04-24
Time: 11:30

Re: TBS auto merge object array

Ah !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Great !!!!!!

In fact my eyes have misled me !

Thank you ;)
By: cerede2000
Date: 2013-04-24
Time: 11:32

Re: TBS auto merge object array

Please remove mail address ans phone number in my last last post.

Thank you.
By: cerede2000
Date: 2013-04-25
Time: 20:22

Re: TBS auto merge object array

S'il te plaît Skrol peux tu retirer les info que j'ai donné en haut merci :)
By: Skrol29
Date: 2013-04-26
Time: 00:06

Re: TBS auto merge object array

Ok, c'est fait.
By: cerede2000
Date: 2013-04-26
Time: 08:05

Re: TBS auto merge object array

Merci beaucoup :)