com.getperka.flatpack.fast.php.stg Maven / Gradle / Ivy
/*
* #%L
* FlatPack Automatic Source Tool
* %%
* Copyright (C) 2012 Perka Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
entity(entity) ::= <<
\
class extends {
protected static $_entityDescription;
protected static $_allProperties;
// initialize collection properties
function __construct() {
parent::__construct();
_)) $this->_ = array();}; separator="\n">
}
public static function initialize() {
self::$_allProperties = array();
self::$_entityDescription = FPEntityDescription::newWithDictionary(
array(
"typeName" => "",
"superType" => ::entityDescription(),
"kind" => "",
"properties" => self::$_allProperties));
FPEntityDescription::setEntityDescription(self::$_entityDescription, "");
}
public static function entityDescription() {
return self::$_entityDescription;
}
}
::initialize();
?\>
>>
entityAccessors(property) ::= <<
// one-to-many accessors to maintain bi-directional relationships
public function () {
return $this->_;
}
public function set($) {
$this->_ = (array)$;
foreach($this->_ as $obj){
$obj->set($this);
}
}
public function addItemTo($item) {
array_push($this->_, $item);
$item->set($this);
}
// many-to-one accessors to maintain bi-directional relationships
public function () {
return $this->_;
}
public function set($) {
$this->_ = $;
if(!in_array($this, $this->_->())) {
$this->_->addItemTo($this);
}
}
// accessors
public function () {
return $this->_;
}
public function set($) {
$this->_ = $;
}
>>
property(property) ::= <%
<\n>
protected $_;
%>
propertyAdd(property) ::= <<
//
array_push(self::$_allProperties,
FPProperty::setPropertyForUuid("",
array(
"name" => "",
"embedded" => truefalse,
"kind" => "",
"impliedProperty" => FPProperty::propertyForUuid(""))));
array(
"name" => "",
"embedded" => truefalse,
"kind" => "")));
>>
/**
* Emit a doc string, reflowed to fit the current context.
*/
docString(docString) ::= <<
/**
*/
>>
endpointDeclaration(endpoint) ::= <<
>>
endpointRequestInterface(endpoint) ::= <<
@interface : FPFlatpackRequest
*)with:(NSString *);}; separator="\n">
-()execute;
-(void)executeUsingBlock:()block;
@end
>>
endpointRequestImplementation(endpoint) ::= <<
class extends FPFlatpackRequest {
public function execute() {
return $this->baseExecute();
}
}
>>
endpointWithMethod(p) ::= <<
public function with($) {
$this->setQueryParameterWithName("", $);
return $this;
}
>>
apiHeader(api) ::= <<
// Generated File - DO NOT EDIT
#import \
#import "FPBaseApi.h"
#import "FPBaseHasUuid.h"
#import "FPFlatpackRequest.h"
;}; separator="\n">
)();}; separator="\n">
@interface BaseApi : FPBaseApi
;
}; separator="\n">
@end
>>
api(api) ::= <<
\
class BaseApi extends FPBaseApi {
{
$request = new ();
$request->initWithApi($this, "", "", array(}; separator=", ">));
$request->setEntity($);
return $request;
\}}; separator="\n\n">
}
?\>
>>
base(base, dir) ::= <<
\"}; separator=",\n">
);
?\>
>>