public static function isAttachedToEntity($entity, $entity_id, $uuid) { $c = new Criteria(); $c->add(sfPhotoGalleryPeer::ENTITY, $entity); $c->add(sfPhotoGalleryPeer::ENTITY_ID, $entity_id); $c->add(sfPhotoGalleryPeer::UUID, $uuid); $c->setIgnoreCase(true); if (sfPhotoGalleryPeer::doCount($c) > 0) { sfContext::getInstance()->getLogger()->info('Photo belongs to entity'); return true; } sfContext::getInstance()->getLogger()->info('Photo does not belong to entity'); return false; }