Example #1
0
 /**
  * @param ProfileModel $profile
  * @depends testUpdate
  */
 public function testUpdateResourceAccess(ProfileModel $profile)
 {
     $event = new ProfileEvent();
     $event->setId($profile->getId())->setResourceAccess(array('admin.address' => array(AccessManager::CREATE)));
     $action = new Profile($this->getMockEventDispatcher());
     $action->updateResourceAccess($event);
     $updatedProfile = $event->getProfile();
     $this->assertInstanceOf('Thelia\\Model\\Profile', $updatedProfile);
     $resources = $updatedProfile->getResources();
     $this->assertEquals(1, count($resources));
     $resource = $resources->getFirst();
     $this->assertEquals('admin.address', $resource->getCode());
     $profileResource = $updatedProfile->getProfileResources()->getFirst();
     $accessManager = new AccessManager($profileResource->getAccess());
     $this->assertTrue($accessManager->can(AccessManager::CREATE));
 }
Example #2
0
 /**
  * Exclude object from result
  *
  * @param   ChildProfile $profile Object to remove from the list of results
  *
  * @return ChildProfileQuery The current query, for fluid interface
  */
 public function prune($profile = null)
 {
     if ($profile) {
         $this->addUsingAlias(ProfileTableMap::ID, $profile->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * @param Profile $object
  * @return int
  */
 protected function getObjectId($object)
 {
     return $object->getId();
 }
Example #4
0
 /**
  * Declares an association between this object and a ChildProfile object.
  *
  * @param                  ChildProfile $v
  * @return                 \Thelia\Model\ProfileI18n The current object (for fluent API support)
  * @throws PropelException
  */
 public function setProfile(ChildProfile $v = null)
 {
     if ($v === null) {
         $this->setId(NULL);
     } else {
         $this->setId($v->getId());
     }
     $this->aProfile = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildProfile object, it will not be re-added.
     if ($v !== null) {
         $v->addProfileI18n($this);
     }
     return $this;
 }
Example #5
0
 /**
  * Filter the query by a related \Thelia\Model\Profile object
  *
  * @param \Thelia\Model\Profile|ObjectCollection $profile The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildProfileModuleQuery The current query, for fluid interface
  */
 public function filterByProfile($profile, $comparison = null)
 {
     if ($profile instanceof \Thelia\Model\Profile) {
         return $this->addUsingAlias(ProfileModuleTableMap::PROFILE_ID, $profile->getId(), $comparison);
     } elseif ($profile instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ProfileModuleTableMap::PROFILE_ID, $profile->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByProfile() only accepts arguments of type \\Thelia\\Model\\Profile or Collection');
     }
 }