Skip to content

Commit

Permalink
+ clearActiveAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
svobik7 committed May 18, 2017
1 parent 86279ee commit b41529f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/GxActiveRecord.php
Expand Up @@ -16,7 +16,6 @@
/**
* GxActiveRecord is the base class for classes representing relational data in terms of objects.
*
* @author Jiri Svoboda <jiri.svoboda@dlds.cz>
*/
abstract class GxActiveRecord extends ActiveRecord
Expand All @@ -36,7 +35,19 @@ abstract class GxActiveRecord extends ActiveRecord
*/
public function __toString()
{
return (string) $this->getRecordPrint();
return (string)$this->getRecordPrint();
}

/**
* Clears all AR attributes
*/
public function clearActiveAttributes()
{
$attrs = $this->activeAttributes();

foreach ($attrs as $attr) {
$this->$attr = null;
}
}

/**
Expand Down

0 comments on commit b41529f

Please sign in to comment.