Hello everybody! Please tell me the way (preferably immediately write example code) by which I can get id list (or id arrray) of all existing records in "Contact" Entity. Thx for help!
Announcement
Collapse
No announcement yet.
Get all Contacts id list
Collapse
X
-
I'm sorry, can you say more precisely Juri:
i have this EntryPoint:
<?php
namespace Espo\Custom\EntryPoints;
class myEp extends \Espo\Core\EntryPoints\Base
{
public static $authRequired = false;
public function run()
{
$contactList = $this->getEntityManager()->getRepository('Contact')->find();
echo var_dump($contactList);
}
}
then i call it, i see next one: object(Espo\ORM\EntityCollection)#67 (4) { ["entityFactory":"Espo\ORM\EntityCollection"rivate]=> object(Espo\ORM\EntityFactory)#44 (2) { ["metadata"rotected]=> object(Espo\ORM\Metadata)#43 (1) { ["data"rotected]=> array(41) { ["Attachment"]=> array(3) { ["fields"]=> array(14) { ["id"]=> array(3) { ["dbType"]=> string(7) "varchar" ["len"]=> int(24) ["type"]=> string(2) "id" } ["name"]=> array(2) { ["type"]=> string(7) "varchar" ["len"]=> int(255) } ["deleted"]=> array(2) { ["type"]=> string(4) "bool" ["default"]=> ... and etc.
i see this object and it properties,
but when i try to add $entity->id like this:
public function run()
{
$contactList = $this->getEntityManager()->getRepository('Contact')->find()->id;
echo $contactList; // or echo $contactList[1]; or echo var_dump($contactList);
}
i see null
where is my error?
I'm very, very grateful for your help!
Comment
Comment