Skip to content

Instantly share code, notes, and snippets.

View converge's full-sized avatar

John Vanzuita converge

View GitHub Profile
indIEDest = 2
try:
inv.partner_id.inscr_est
indIEDest = 1
except NameError:
indIEDest = 2
# i dont know if inv.partner_id.inscr_est is set
if inv.partner_id.inscr_est:
indIEDest = 1
public function add()
{
$userId = null;
$client = $this->Clients->newEntity();
$client = $this->Clients->patchEntity($client, $this->request->data);
if ($this->request->is('post')) {
$user = $this->Clients->User->newEntity();
$user->role_id = 2;
$user->username = $this->request->data['cnpj'];
#
# ClientsController
#
# I have this Client table, and User table, need to create a user(login/password) when creating a client
#
public function add() {
$client = $this->Clients->newEntity();
if ($this->request->is('post')) {
$client = $this->Clients->patchEntity($client, $this->request->data);
#
# ClientsController
#
public function add()
{
$client = $this->Clients->newEntity();
if ($this->request->is('post')) {
$this->request->data['user'] = [ 'username' => 'teste', 'password' => 'teste' ];
debug($this->request->data);
public function index()
{
$this->paginate = [
'contain' => ['Roles']
];
$this->set('users', $this->paginate($this->Users));
$this->set('_serialize', ['users']);
}
object(Cake\ORM\Query) {
'sql' => 'SELECT PriceLists.description AS `PriceLists__description` FROM price_lists PriceLists',
'params' => [],
'defaultTypes' => [
'PriceLists.id' => 'integer',
'id' => 'integer',
'PriceLists.description' => 'string',
'description' => 'string',
$priceLists = $this->Products->PriceLists->find('list', array('fields' => 'description'));
debug($priceLists);
<?
public function view($category = null ,$slug = null) {
if (! $slug) {
$this->Flash->success ( 'Invalid id for Product' );
$this->redirect ( '/products' );
}
$query = $this->Products->find()->where(
[
<?
public function view($category = null ,$slug = null) {
if (! $slug) {
$this->Flash->success ( 'Invalid id for Product' );
$this->redirect ( '/products' );
}
$query = $this->Products->find()->where(
[