Bolt\Storage\Repository::update PHP Method

update() public method

Updates an object into the database.
public update ( object $entity, string[] $exclusions = [] ) : boolean
$entity object The entity to update.
$exclusions string[] Ignore updates to these fields
return boolean
    public function update($entity, $exclusions = [])
    {
        $querySet = new QuerySet();
        $querySet->setParentId($entity->getId());
        $qb = $this->em->createQueryBuilder();
        $qb->update($this->getTableName())->where('id = :id')->setParameter('id', $entity->getId());
        $querySet->append($qb);
        $this->persist($querySet, $entity, $exclusions);
        return $querySet->execute();
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function update($entity, $exclusions = [])
 {
     // Forget remembered users.
     $this->userEntities = [];
     if ($entity->getPassword() === null) {
         $result = parent::update($entity, ['password']);
     } else {
         $result = parent::update($entity);
     }
     return $result;
 }
All Usage Examples Of Bolt\Storage\Repository::update