本文整理汇总了PHP中Singleton::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Singleton::create方法的具体用法?PHP Singleton::create怎么用?PHP Singleton::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Singleton
的用法示例。
在下文中一共展示了Singleton::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateManyToManySetter
private function generateManyToManySetter(ManyToManyProperty $property)
{
$containerProp = $property->getEntity()->getPrimaryKey()->getName();
$containedProp = Singleton::create("ServiceBuilder")->getEntity($property->getEntityName())->getPrimaryKey()->getName();
$signature = "set" . ucfirst($property->getName()) . "(\${$containerProp}, \${$containedProp}s)";
return "\tpublic function {$signature} {\n\t\t\$this->getPersistence()->{$signature};\n\t}\n\n";
}
示例2: __construct
public function __construct()
{
$this->db = Singleton::create("DatabaseManager");
if (is_null(self::$dbCache)) {
self::$dbCache = BeanLocator::get("DatabaseCache");
}
}
示例3: __construct
public function __construct()
{
$this->id = rand(100000, 999999);
if (is_null(self::$settings)) {
self::$settings = Singleton::create("Settings");
}
}
示例4: getAsObject
protected function getAsObject($row)
{
$result = new Teacher();
$result->setNew(false);
$result->setTeacherId(Singleton::create("NullConverter")->fromDBtoDOM($row["teacherId"]));
$result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
return $result;
}
示例5: getAsObject
protected function getAsObject($row)
{
$result = new BoggleGame();
$result->setNew(false);
$result->setGameId(Singleton::create("NullConverter")->fromDBtoDOM($row["gameId"]));
$result->setStarted(Singleton::create("BooleanConverter")->fromDBtoDOM($row["started"]));
return $result;
}
示例6: getAsObject
protected function getAsObject($row)
{
$result = new BogglePlayer();
$result->setNew(false);
$result->setPlayerId(Singleton::create("NullConverter")->fromDBtoDOM($row["playerId"]));
$result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
$result->setGameId(Singleton::create("NullConverter")->fromDBtoDOM($row["gameId"]));
return $result;
}
示例7: getAsObject
protected function getAsObject($row)
{
$result = new Address();
$result->setNew(false);
$result->setAddressId(Singleton::create("NullConverter")->fromDBtoDOM($row["addressId"]));
$result->setStreet(Singleton::create("NullConverter")->fromDBtoDOM($row["street"]));
$result->setLocation(Singleton::create("NullConverter")->fromDBtoDOM($row["location"]));
return $result;
}
示例8: getOneToManyMappedGettersSetters
private function getOneToManyMappedGettersSetters(Entity $entity)
{
$result = "";
foreach (Singleton::create("ServiceBuilder")->getOneToManyMappedProperties($entity) as $property) {
$entityName = $property->getEntity()->getName();
$name = $property->getMappingKey();
$result .= "\tprivate \${$name};\n\n" . "\tpublic function get" . ucfirst($name) . "() {\n\t\treturn \$this->{$name};\n\t}\n\n" . "\tpublic function get" . $entityName . "() {\n\t\treturn {$entityName}ServiceUtil::get{$entityName}(\$this->{$name});\n\t}\n\n" . "\tpublic function set" . ucfirst($name) . "(\${$name}) {\n\t\t\$this->{$name} = \${$name};\n\t}\n\n";
}
return $result;
}
示例9: getAsObject
protected function getAsObject($row)
{
$result = new BubbleHighScore();
$result->setNew(false);
$result->setHscoreId(Singleton::create("NullConverter")->fromDBtoDOM($row["hscoreId"]));
$result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
$result->setPlayDate(Singleton::create("DateConverter")->fromDBtoDOM($row["playDate"]));
$result->setSeconds(Singleton::create("NullConverter")->fromDBtoDOM($row["seconds"]));
return $result;
}
示例10: getAsObject
protected function getAsObject($row)
{
$result = new User();
$result->setNew(false);
$result->setId(Singleton::create("NullConverter")->fromDBtoDOM($row["id"]));
$result->setFirstName(Singleton::create("NullConverter")->fromDBtoDOM($row["firstName"]));
$result->setLastName(Singleton::create("NullConverter")->fromDBtoDOM($row["lastName"]));
$result->setCreateDate(Singleton::create("DateConverter")->fromDBtoDOM($row["createDate"]));
$result->setDefault(Singleton::create("BooleanConverter")->fromDBtoDOM($row["default"]));
return $result;
}
示例11: moveToDir
public function moveToDir($destinationDir, $renamedFile = null)
{
$newName = is_null($renamedFile) ? $this->getFileName() : $renamedFileName;
$root = Singleton::create("Settings")->getRootPath();
$relativeDestination = "{$destinationDir}/{$newName}";
$uploadDestination = "{$root}/{$relativeDestination}";
if (!move_uploaded_file($this->tempServerName, $uploadDestination)) {
throw new FileUploadException("File cannot be moved from temporary directory");
}
$this->relativeDestination = $relativeDestination;
}
示例12: generateMappingTable
private function generateMappingTable($table, $props)
{
$sql = "CREATE TABLE `{$table}` (\n";
$pkNames = array();
foreach ($props as $prop) {
$pk = Singleton::create("ServiceBuilder")->getEntity($prop->getEntityName())->getPrimaryKey();
$pkName = "`{$pk->getName()}`";
$sql .= "\t{$pkName} {$pk->getDbType()} NOT NULL,\n";
$pkNames[] = $pkName;
}
return $sql . "\t PRIMARY KEY (" . implode(",", $pkNames) . ")\n);\n\n";
}
示例13: getConverter
private function getConverter()
{
$t = is_null($this->type) ? "Null" : $this->type;
return Singleton::create("Domain{$t}Converter");
}
示例14: getPersistence
private function getPersistence()
{
return Singleton::create("TeamPersistence");
}
示例15: getService
private static function getService()
{
return Singleton::create("BubbleHighScoreService");
}