tags:

views:

23

answers:

2

hello ,

i get table - $data = Doctrin ::getTable('product_catalog')->findAll();. this table (product_catalog) i link table. have 2 couloms with foreign keys.

how i can check on $data have relation?

thanks

A: 

Try $data->hasRelation('RelationName') which will check for the existence of the related object on your foreign key. Replace RelationName with the real name of your relation.

PeterB
in version 2.0 the function 'hasRelation' was not exists.maybe have another solution?
Elad Kaplan
+1  A: 

i secsess to get relation from table. see this code

$data = ORM::getTable($modelName)->findAll(); - get the table. $relations = $data->getTable()->getRelations(); - >get to relation foreach($relations as $key=>$row) { echo "

"; var_dump($key); echo "
";

} die(); this is print on screen ths table relation.

Elad Kaplan