getColumnByProperty() public method

Get a column by its property name, or null if no such column exists
public getColumnByProperty ( $name ) : Column | null
$name
return Column | null
Example #1
0
 /**
  * Get the value of a property on the entity
  *
  * @param string $name
  * @return mixed
  */
 public function getPropertyValue($name)
 {
     if ($column = $this->metadata->getColumnByProperty($name)) {
         $getter = $column->getGetter();
         return $this->entity->{$getter}();
     } elseif ($relationship = $this->metadata->getRelationshipByName($name)) {
         $getter = $relationship->getGetter();
         return $this->entity->{$getter}();
     } else {
         throw new InvalidArgumentException("No column/relationship found for property '" . $name . "'");
     }
 }