/**
  * @param string $property
  * @return string
  * @throws Exception
  */
 private function getSearchableProperty($property)
 {
     $property = Meta\Reflection::singularizeProperty($property);
     foreach ($this->meta->getIndexedProperties() as $p) {
         if (Meta\Reflection::singularizeProperty($p->getName()) == $property) {
             return $property;
         }
     }
     throw new Exception("Property {$property} is not indexed.");
 }
Exemple #2
0
 function testDoubleS()
 {
     $this->assertEquals('access', Reflection::singularizeProperty('access'));
 }
Exemple #3
0
 /**
  * Finds property by $name.
  *
  * @param string $name
  * @return \HireVoice\Neo4j\Meta\Property|null
  */
 public function findProperty($name)
 {
     $property = Reflection::getProperty($name);
     foreach ($this->properties as $p) {
         if ($p->matches(substr($name, 3), $property)) {
             return $p;
         }
     }
     foreach ($this->manyToManyRelations as $p) {
         if ($p->matches(substr($name, 3), $property)) {
             return $p;
         }
     }
     foreach ($this->manyToOneRelations as $p) {
         if ($p->matches(substr($name, 3), $property)) {
             return $p;
         }
     }
     return null;
 }
Exemple #4
0
 /**
  * @param $names
  * @return bool
  */
 function matches($names)
 {
     foreach (func_get_args() as $name) {
         if (0 === strcasecmp($name, $this->name) || 0 === strcasecmp($name, $this->property->getName()) || 0 === strcasecmp($name, Reflection::singularizeProperty($this->property->getName()))) {
             return true;
         }
     }
     return false;
 }