protected function isPlural($name) { // das ist nicht so schön, aber ich hab grad keine schönere idee als eine liste aller entities zu haben (entity meta?) return Inflector::plural(Inflector::singular($name)) === $name; }
/** * Der EntityName in Plural ist eine KurzForm der Klasse in plural * * Dies ist für \tiptoi\Entities\Sound z. b. "sounds" */ public function getEntityNamePlural() { return \Psc\Inflector::plural($this->getEntityName()); }
/** * Gibt den Namen für die Methoden des Relation Interfaces zurück * * z.B. wird dann verwendet als * OID addOID, removeOID, getOIDs * OIDMeta addOIDMeta, setOIDMeta * SomeClassName addSomeClassName, removeSomeClassName, setSomeClassNames * usw * * @return string */ public function getMethodName($singularOrPlural = 'singular') { if (!isset($singularOrPlural)) { $singularOrPlural = $this->getValueType() === self::COLLECTION_VALUED ? 'plural' : 'singular'; } if (!isset($this->methodName)) { $this->methodName = array($this->getName(), Inflector::plural($this->getName())); } return $singularOrPlural === 'singular' ? $this->methodName[0] : $this->methodName[1]; }