Show Menu
Cheatography

Php + Yii code templates for NetBeans Cheat Sheet by [deleted]

This code template is based on the Yii/PHP NetBeans template downloadable here: http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

Yii model methods

yafter­con­struct
yafter­delete
yafterfind
yaftersave
yafter­val­idate
yattri­but­elabels
ybefor­edelete
ybefor­efind
ybefor­esave
ybefor­eva­lidate
ybehaviors
ydefau­ltscope
yrelations
yrules
yscope
yscopes
yvalidator

Yii controller methods

yacces­srules
yaction
yactions
yafter­action
yafter­render
ybefor­eaction
ybefor­erender
ybehaviors
yfilters

Yii function calls

ya
Yii::app()
ybu
Yii::a­pp(­)->­baseUrl
yca
Yii::a­pp(­)->­use­r->­che­ckA­ccess()
yd
CVarDu­mpe­r::­dump()
ym
${mode­lCl­ass­}::­model()
yt
Yii::t()
yu
Yii::a­pp(­)->user
yurl
Yii::a­pp(­)->­cre­ate­Url()
 

Yii generic methods

yinit
yrun

Yii view templates

ybegin­widget
$this-­>be­gin­Widget
ybu
Yii::a­pp(­)->­baseUrl
ywidget
$this-­>wi­dge­t(...)

Php print data

eco
echo(“­${m­ess­age}”); ${cursor}
pr
print ${VARIABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}; ${cursor}
prln
print ${VARIABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}."\n­"; ${cursor}
prs
print "­${c­urs­or}­";
prv
print "­\${­VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"} = ".${­VAR­IABLE editab­le=­fal­se}."\n­"; ${cursor}

Php generics

cls
class ${Clas­sName} { function ${__co­nst­ruct}() { ${sele­cti­on}­${c­ursor} } }
fnc
function ${func­tio­nNa­me}­($$­${p­aram}) { ${sele­cti­on}­${c­ursor} }
iface
interface ${Inte­rfa­ceName} { ${cursor} }
ifnc
public function ${func­tio­nNa­me}­($$­${p­aram});
pcon
parent­::_­_co­nst­ruct(); ${cursor}
thr
throw new ${Exce­ption};
tryc
try { ${sele­cti­on}­${c­ursor} } catch (${Exc­eption} $$${exc}) { echo $$${exc editab­le=­fal­se}­->g­etT­rac­eAs­Str­ing(); }
vdoc
/ @var $$${VA­RIABLE variab­leF­rom­Nex­tAs­sig­nme­ntName defaul­t="v­ari­abl­e"} ${VAR_TYPE variab­leF­rom­Nex­tAs­sig­nme­ntType defaul­t="C­las­sNa­me"} /
 

Php statements

do
do { ${sele­cti­on}­${c­ursor} } while (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"});
elif
elseif (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
els
else { ${sele­cti­on}­${c­ursor} }
fore
foreach (${ARRAY variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="a­rra­y" defaul­t="$­arr­ay"} as $$${va­lue}) { ${sele­cti­on}­${c­ursor} }
if
if (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
inst
if (${VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"} instanceof ${Clas­sName}) { ${sele­cti­on}­${c­ursor} }
itdir
$$${DIRH newVarName defaul­t="d­irh­"} = opendi­r($­{$d­irn­ame}); if ($$${DIRH editab­le=­false}) { while (($$${­DIR­_ELEM newVarName defaul­t="d­irE­lem­ent­"} = readdi­r($­{DIRH editab­le=­fal­se})) !== false) { ${sele­cti­on}­${c­ursor} } closed­ir(­$$$­{DIRH editab­le=­fal­se}); }
iter
for ($$${IDX newVarName defaul­t="i­nde­x"} = 0; $$${IDX editab­le=­false} < count(­${ARRAY variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="a­rra­y" defaul­t="$­arr­ay"}); $$${IDX editab­le=­fal­se}++) { ${sele­cti­on}­${c­ursor} }
swi
switch (${VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}) { case ${$value}: ${sele­cti­on}­${c­ursor} break; default: break; }
while
while (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
               
 

Comments

good design in yii, thanks for it

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Selenium WebDriver Cheat Sheet Cheat Sheet
          Cypressio Cheat Sheet
          ISTQB Test Automation Engineering Cheat Sheet

          More Cheat Sheets by [deleted]

          Php code templates for NetBeans Cheat Sheet
          Yii code templates for Netbeans Cheat Sheet
          Bazaar version control system Cheat Sheet