phalcon: 独立的映射,字段名名别名

时间:2023-03-09 17:04:57
phalcon: 独立的映射,字段名名别名
class ProductsController extends \Phalcon\Mvc\Controller
{ public function saveAction()
{ //Obtain the TransactionsManager from the services container
$manager = $this->di->getTransactions(); //Or
$manager = $this->transactions; //Request a transaction
$transaction = $manager->get(); //...
} }

  

使用:

//Find a robot by its name
$robot = Robots::findFirst("theName = 'Voltron'");
echo $robot->theName, "\n"; //Get robots ordered by type
$robot = Robots::find(array('order' => 'theType DESC'));
foreach ($robots as $robot) {
echo 'Code: ', $robot->code, "\n";
} //Create a robot
$robot = new Robots();
$robot->code = '10101';
$robot->theName = 'Bender';
$robot->theType = 'Industrial';
$robot->theYear = 2999;
$robot->save();