Gc\Property\Collection::save PHP Method

save() public method

Save properties
public save ( ) : boolean
return boolean
    public function save()
    {
        $properties = $this->getProperties();
        try {
            foreach ($properties as $property) {
                $property->save();
            }
            return true;
        } catch (\Exception $e) {
            throw new \Gc\Exception($e->getMessage());
        }
    }

Usage Example

Esempio n. 1
0
 /**
  * Test
  *
  * @return void
  */
 public function testSaveWithWrongValues()
 {
     $configuration = Registry::get('Application')->getConfig();
     if ($configuration['db']['driver'] == 'pdo_mysql') {
         $this->markTestSkipped('Mysql does not thrown exception.');
     }
     $this->setExpectedException('Gc\\Exception');
     $this->property->setIdentifier(null);
     $this->object->setProperties(array($this->property->getData()));
     $this->assertFalse($this->object->save());
 }