/** * Sorts first by primary field, then sorts by property name alphabetically * @param Property $a * @param Property $b * @return int */ protected static function sortByPrimaryAndPropertyNameValue(Property $a, Property $b) { if ($a->getPrimary() == $b->getPrimary()) { //primary field is set to 1, all not-primary property objects have primary field set to 0. return $a->getPropertyName() < $b->getPropertyName() ? -1 : 1; } return $a->getPrimary() > $b->getPrimary() ? -1 : 1; }
public function __construct(Property $property) { $this->propertyName = $property->getPropertyName(); $this->targetEntity = $property->getTargetEntity() ? "\\" . $property->getTargetEntity() . " " : ""; }