Exemple #1
0
 /**
  * @param string $attribute
  * @param Album $album
  * @param TokenInterface $token
  * @return bool|null
  */
 protected function voteOnAttribute($attribute, $album, TokenInterface $token)
 {
     $user = $token->getUser();
     if (!$user instanceof User) {
         return null;
     }
     switch ($attribute) {
         case 'edit':
             if ($user->getId() == $album->getSendBy()) {
                 return true;
             }
     }
 }
Exemple #2
0
 /**
  * @param ChildAlbum $album The ChildAlbum object to add.
  */
 protected function doAddAlbum(ChildAlbum $album)
 {
     $this->collAlbums[] = $album;
     $album->setUser($this);
 }
Exemple #3
0
 /**
  * Filter the query by a related \Tekstove\ApiBundle\Model\Album object
  *
  * @param \Tekstove\ApiBundle\Model\Album|ObjectCollection $album the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserQuery The current query, for fluid interface
  */
 public function filterByAlbum($album, $comparison = null)
 {
     if ($album instanceof \Tekstove\ApiBundle\Model\Album) {
         return $this->addUsingAlias(UserTableMap::COL_ID, $album->getsendBy(), $comparison);
     } elseif ($album instanceof ObjectCollection) {
         return $this->useAlbumQuery()->filterByPrimaryKeys($album->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByAlbum() only accepts arguments of type \\Tekstove\\ApiBundle\\Model\\Album or Collection');
     }
 }
Exemple #4
0
 /**
  * Exclude object from result
  *
  * @param   ChildAlbum $album Object to remove from the list of results
  *
  * @return $this|ChildAlbumQuery The current query, for fluid interface
  */
 public function prune($album = null)
 {
     if ($album) {
         $this->addUsingAlias(AlbumTableMap::COL_ID, $album->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }