Skip to content

Instantly share code, notes, and snippets.

@damianoporta
Last active November 2, 2015 15:14
Show Gist options
  • Save damianoporta/298ccd4e67245debee1d to your computer and use it in GitHub Desktop.
Save damianoporta/298ccd4e67245debee1d to your computer and use it in GitHub Desktop.
<?php
/*
* Controlla se l'annuncio è di un determinato utente
*
* @param integer $adId Id annuncio
* @param integer $userId Id utente
* @return boolean L'annuncio è dell'utente?
*/
public function hasOwner($adId, $userId)
{
$n = $this->find()
->where([
'Ads.id' => $adId,
'Ads.user_id' => $userId
])
->count();
return $n === 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment