本文整理汇总了PHP中Entity::getFinders方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::getFinders方法的具体用法?PHP Entity::getFinders怎么用?PHP Entity::getFinders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::getFinders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate(Entity $entity)
{
$className = "{$entity->getName()}Persistence";
$content = "<?php\nclass {$className} extends Persistence {\n\n" . "\tconst TABLE = \"{$entity->getTable()}\";\n\n";
foreach ($entity->getFinders() as $finder) {
$content .= $this->generateFinder($finder, $entity);
$content .= $this->generateDeleteBy($finder, $entity);
}
$content .= $this->generateFindByPrimaryKey($entity);
$content .= $this->generateCreate($entity);
$content .= $this->generateRemove($entity);
$content .= $this->generateUpdate($entity);
$content .= $this->generateFindAll($entity);
$content .= $this->generateGetCount($entity);
$content .= $this->generateGetAsObject($entity);
foreach (Singleton::create("ServiceBuilder")->getOneToManyMappedProperties($entity) as $property) {
$content .= $this->generateOneToManyFinder($property);
}
foreach (Singleton::create("ServiceBuilder")->getManyToManyMappedProperties($entity) as $property) {
$content .= $this->generateManyToManyFinder($property);
}
foreach ($entity->getManyToManyProperties() as $property) {
$content .= $this->generateManyToManySetter($property);
}
$content .= "}\n?>";
$destination = "src/service/persistence/{$className}.php";
FileUtil::storeFileContents($destination, $content);
}
示例2: generateIndexes
private function generateIndexes(Entity $entity)
{
$indexes = array("\tPRIMARY KEY (`{$entity->getPrimaryKey()->getName()}`)");
foreach ($entity->getFinders() as $finder) {
$indexes[] = "\t" . $finder->getIndexDefinition();
}
return $indexes;
}
示例3: generate
public function generate(Entity $entity)
{
$className = "{$entity->getName()}ServiceBase";
$content = "<?php\nclass {$className} {\n\n";
foreach ($entity->getFinders() as $finder) {
$content .= $this->generateFinder($finder->getMethodSignature());
$content .= $this->generateDeleteBy($finder->getDeleteByMethodSignature());
}
$content .= $this->generateBaseServices($entity);
foreach (Singleton::create("ServiceBuilder")->getOneToManyMappedProperties($entity) as $property) {
$content .= $this->generateFinder($property->getFinderSignature());
}
foreach (Singleton::create("ServiceBuilder")->getManyToManyMappedProperties($entity) as $property) {
$content .= $this->generateFinder($property->getFinderSignature());
}
foreach ($entity->getManyToManyProperties() as $property) {
$content .= $this->generateManyToManySetter($property);
}
$content .= "}\n?>";
// Write file to class
$destination = "src/service/service/{$className}.php";
FileUtil::storeFileContents($destination, $content);
}