CRUD com Flex e Zend_AMF – Parte 2

Se você ainda não leu CRUD com Flex e Zend_AMF – Parte 1, leia agora :)

Agora que nossa conexão foi estabelecida, podemos começar a adicionar registros. Esta é a nossa primeira tarefa, e para isso precisamos criar um formulário de entrada de dados. Geralmente os formulários de entrada de dados são feitos em uma popup, e vamos seguir esta regra, ok? Crie um novo MXML Component, chamado: PessoaForm.mxml, conforme a imagem a seguir:

image

O código inicial deste componente está a seguir:

<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
		   xmlns:s="library://ns.adobe.com/flex/spark"
		   xmlns:mx="library://ns.adobe.com/flex/mx"
		   width="300" height="150"
		   title="Pessoa"
		   close="{PopUpManager.removePopUp(this)}"
		   >
<s:layout>
	<s:VerticalLayout/>
</s:layout>

<fx:Declarations>
	<!-- Place non-visual elements
	(e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
	<![CDATA[
		import mx.managers.PopUpManager;

		import spark.components.PopUpAnchor;
	]]>
</fx:Script>

<mx:Form width="100%" height="100%">
	<mx:FormItem label="Nome:" width="100%">
		<s:TextInput id="nome" width="100%"/>
	</mx:FormItem>
	<mx:FormItem label="Email:" width="100%">
		<s:TextInput id="email" width="100%"/>
	</mx:FormItem>
</mx:Form>

<s:controlBarContent>
	<s:HGroup horizontalAlign="right" width="100%">
		<s:Button id="btnOk" label="OK"/>
		<s:Button id="btnCancelar"
				  label="Cancelar"
				  click="{PopUpManager.removePopUp(this)}"/>
	</s:HGroup>
</s:controlBarContent>

</s:TitleWindow>

Neste código criamos um form com dois campos, mais os botões ok e cancelar. Até aqui nada de mais. O botão cancelar remove o popup, pois este TitleWindow será um popup.

Voltando à aplicação principal, temos que criar o botão que irá abrir este TitleWindow. Alterando o código da aplicação (Parte 1), temos:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
	   xmlns:s="library://ns.adobe.com/flex/spark"
	   xmlns:mx="library://ns.adobe.com/flex/mx"
	   minWidth="955" minHeight="600">

<fx:Declarations>
<mx:RemoteObject id="RemotePessoas"
				 destination="zend"
				 source="Pessoas">

	<mx:method name="TesteConexao"
			   result="OnTestConexaoOk(event)"/>

</mx:RemoteObject>
</fx:Declarations>

<fx:Script>
	<![CDATA[
	import forms.PessoaForm;

	import mx.controls.Alert;
	import mx.managers.PopUpManager;
	import mx.rpc.events.ResultEvent;
	public function OnTestConexaoOk(event:ResultEvent):void
	{
		Alert.show(event.result.toString());
	}
	]]>
</fx:Script>

<s:Button label="Adicionar Pessoa" top="10" left="10">
<s:click>
	<![CDATA[
		var p:PessoaForm = new PessoaForm();
		PopUpManager.addPopUp(p,this,true);
		PopUpManager.centerPopUp(p);
	]]>
</s:click>
</s:Button>

</s:Application>

O botão “Adicionar Pessoa” da aplicação principal abre uma popup, exibindo o formulário abaixo:

Formulário Adicionar Pessoa

Agora podemos voltar ao código do formulário e adicionar a funcionalidade de “adicionar pessoa”. Para isso usamos o RemoteObject. O código do arquivo PessoaForm.mxml fica assim:

...
<fx:Declarations>

 <mx:RemoteObject id="pessoaRemote"
		 destination="zend"
		 source="Pessoas"
		 showBusyCursor="true"
		 >

	<mx:method name="Inserir"
	   result="OnInserir(event)"
	   fault="OnFault(event)"
	   />

  </mx:RemoteObject>

</fx:Declarations>

...

<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.PopUpManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

import spark.components.PopUpAnchor;

protected function OnInserir(event:ResultEvent):void
{
	PopUpManager.removePopUp(this);
}

protected function OnFault(event:FaultEvent):void
{
	Alert.show(event.message.toString(), "ERROR");
}

]]>
</fx:Script>

....

<s:Button id="btnOk" label="OK">
	<s:click>
	<![CDATA[
		pessoaRemote.Inserir(nome.text,email.text);
	]]>
	</s:click>
</s:Button>

As mudanças no código são relativas ao RemoteObject, que possui o método inserir, disparado pelo click do botão. O método inserir deve ser criado no arquivo pessoas.php, conforme o código a seguir:

<?php
class Pessoas
{
	var $db;

	function __construct()
	{
		$this->db = new Zend_Db_Adapter_Pdo_Mysql(array(
		'host'     => '127.0.0.1',
		'username' => 'root',
		'password' => '',
		'dbname'   => 'flexcrud'
		));
	}

	function TesteConexao()
	{
		return "OK";
	}

	function Inserir($nome,$email)
	{
		$data = array('nome'=>$nome,'email'=>$email);
		$this->db->insert('pessoas',$data);
		return $this->db->lastInsertId();
	}

}

Neste momento já podemos testar a aplicação. Caso dê algum erro, verifique o log de erros em c:\wamp\logs\apache_error.log. Mas olhando o código do arquivo pessoas.php, podemos notar que ele tem um problema. Os parâmetros de conexão estão dentro da classe pessoas. Fiz isso de propósito, para mostrar que temos que ter uma visão crítica do nosso código, sempre que possível. Já imaginou termos 10 classes e cada uma delas tem as configurações do banco de dados? E se estas configurações mudarem?? Precisaremos alterar as 10 classes.. (eu acho que isso da justa causa hehe).

Para resolver o problema, podemos usar um pouco de orientação a objetos. Vamos criar uma classe chamada “Base”, que contém essa configuração, e fazer a classe Pessoas herdar de Base. Veja:

base.php:

<?php
class Base
{
	var $db;

	function __construct()
	{
		$this->db = new Zend_Db_Adapter_Pdo_Mysql(array(
		'host'     => '127.0.0.1',
		'username' => 'root',
		'password' => '',
		'dbname'   => 'flexcrud'
		));
	}
}

Agora a classe Pessoas fica assim:

<?php
include("base.php");

class Pessoas extends Base
{
	function __construct()
	{
		parent::__construct();
	}

	function TesteConexao()
	{
		return "OK";
	}

	function Inserir($nome,$email)
	{
		$data = array('nome'=>$nome,'email'=>$email);
		$this->db->insert('pessoas',$data);
		return $this->db->lastInsertId();
	}

}

Desta forma, conseguimos usar a variável $this->db em qualquer classe que herde da classe Base. No próximo artigo da série, criamos um datagrid para ver os dados que estão sendo inseridos.

29 ideias sobre “CRUD com Flex e Zend_AMF – Parte 2

  1. Pingback: CRUD com Flex e Zend_AMF – Parte 1 | flex.etc.br – Livros, tutoriais, exemplos sobre Adobe Flex

  2. Daniel, está sendo muito bom esse tutorial, to seguindo passo-a-passo e entendendo muito bem com funciona, até agora percebi que o código fica bem mais organizado utilizando Zend do que o AMFPHP, só pra incrementar, neste post onde diz…

    <![CDATA[
    pessoaRemote.Inserir(nome.text,email.text);
    ]]<

    o fechamento do “<![CDATA[" está invertido desta forma "]]”.

  3. Pingback: CRUD com Flex e Zend AMF – Parte 4 | flex.etc.br – Livros, tutoriais, exemplos sobre Adobe Flex

  4. Daniel,

    está dando erro quando vou inserir os dados.

    faultString = “The PDO extension is required for this adapter but the extension is not loaded”

    que extensão seria esta?

    eu baixei novamente o Zend Minimal, e peguei a pasta Zend dentro de library, e joguei para dentro do www/flexCRUD/php

    o teste de conexão está funcionando corretamente, o OK retorna perfeitamente, mas no momento em que ele vai inserir dá erro.

    O retorno do erro é grande se ajudar segue-o abaixo:

    (mx.messaging.messages::ErrorMessage)#0
    body = (null)
    clientId = “00F62354-ADC6-74A8-1BD5-00006F49454C”
    correlationId = “832F8030-C50A-8100-8B3A-7EE37E54B253″
    destination = (null)
    extendedData = (null)
    faultCode = “0″
    faultDetail = “#0 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Db\Adapter\Pdo\Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
    #1 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Db\Adapter\Abstract.php(448): Zend_Db_Adapter_Pdo_Mysql->_connect()
    #2 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query(‘INSERT INTO `pe…’, Array)
    #3 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Db\Adapter\Abstract.php(546): Zend_Db_Adapter_Pdo_Abstract->query(‘INSERT INTO `pe…’, Array)
    #4 D:\programas\phpdev_web\www\flexCRUD\php\pessoas.php(24): Zend_Db_Adapter_Abstract->insert(‘pessoas’, Array)
    #5 [internal function]: Pessoas->Inserir(‘maicon’, ‘maiconsilva.pin…’)
    #6 [internal function]: ReflectionMethod->invokeArgs(Object(Pessoas), Array)
    #7 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Server\Reflection\Function\Abstract.php(368): call_user_func_array(Array, Array)
    #8 [internal function]: Zend_Server_Reflection_Function_Abstract->__call(‘invokeArgs’, Array)
    #9 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Amf\Server.php(356): Zend_Server_Reflection_Method->invokeArgs(Object(Pessoas), Array)
    #10 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Amf\Server.php(550): Zend_Amf_Server->_dispatch(‘Inserir’, Array, ‘Pessoas’)
    #11 D:\programas\phpdev_web\www\flexCRUD\php\Zend\Amf\Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #12 D:\programas\phpdev_web\www\flexCRUD\php\gateway.php(24): Zend_Amf_Server->handle()
    #13 {main}”
    faultString = “The PDO extension is required for this adapter but the extension is not loaded”
    headers = (Object)#1
    messageId = “53CB6E36-2953-B2C8-D2A1-000018487840″
    rootCause = (null)
    timestamp = 127773412600
    timeToLive = 0

  5. Boa tarde, estou inciando no flex, e venho acompanhando seus tutoriais.
    Nessa parte eu tive o mesmo erro que os amigos Paulo Barcelos, e Fabio.
    Existe alguma solução, ou foi erro meu?

    Desde já grato pela atenção

    Roberto

      • Daniel

        Funcionou sim, eu não tinha me atentado para o comentário dele antes de postar a dúvida, agradeço a dica. Estou ansioso para seu livro de AS3. E sobre o Flash Builder 4 quais você recomenda para quem está iniciando?
        E se eu puder dar uma sugestão, que tal um curso no formato de video aulas, estilos aquelas do site lynda.com?? acho que ia ser um grande sucesso.

        Grato

  6. Bom dia,

    Consegui reproduzir o mesmo erro, alterando o nome da TABELA no banco MySQL, queria utilizar USUARIOS (errado) em vez de PESSOAS (correto).

    Para utilizar USUARIO, basta alterar o arquivo “pessoas.php” na linha:
    de
    $this->db->insert(‘pessoas’,$data);
    para
    $this->db->insert(‘usuarios’,$data);

    Abr.
    e parabéns pelo post.

    Att.,
    Jean Fellipe

  7. Teria cuidado com o nome do banco “flexCRUD” . Pois no linux, o mysql é case sensitive, no Windows não.

    Então se criar um banco “flexCRUD”, no arquivo base.php, ao invés de “flexcrud”, o correto seria colocar o nome do banco como foi criado. Pois, ao exportar para o servidor linux, provavelmente terá dor de cabeça.

  8. Olá Daniel, tem como vc me dar uma ajuda?

    Quando tento inserir dados programa gera um erro.

    (mx.messaging.messages::ErrorMessage)#0
    body = (Object)#1
    clientId = (null)
    correlationId = “720E4429-7383-9A8E-F73A-941B0097E418″
    destination = “”
    extendedData = (null)
    faultCode = “Client.Error.MessageSend”
    faultDetail = “Channel.Security.Error error Error #2048: Violação da área de segurança: http://localhost/flexCRUD/flexCRUD.swf não pode carregar dados de http://flexCRUD/php/gateway.php. url: ‘http://flexCRUD/php/gateway.php'
    faultString = “Send failed”
    headers = (Object)#2
    messageId = “09D23CD8-D196-00CB-88C4-941B1B53EDEC”
    rootCause = (mx.messaging.events::ChannelFaultEvent)#3
    bubbles = false
    cancelable = false
    channel = (mx.messaging.channels::AMFChannel)#4
    authenticated = false
    channelSets = (Array)#5
    connected = false
    connectTimeout = -1
    enableSmallMessages = true
    endpoint = “http://flexCRUD/php/gateway.php”
    failoverURIs = (Array)#6
    id = “zend-endpoint”
    mpiEnabled = false
    netConnection = (flash.net::NetConnection)#7
    client = (mx.messaging.channels::AMFChannel)#4
    connected = false
    maxPeerConnections = 8
    objectEncoding = 3
    proxyType = “none”
    uri = “http://flexCRUD/php/gateway.php”
    piggybackingEnabled = false
    polling = false
    pollingEnabled = true
    pollingInterval = 3000
    protocol = “http”
    reconnecting = false
    recordMessageSizes = false
    recordMessageTimes = false
    requestTimeout = -1
    uri = “http://flexCRUD/php/gateway.php”
    url = “http://flexCRUD/php/gateway.php”
    useSmallMessages = false
    channelId = “zend-endpoint”
    connected = false
    currentTarget = (mx.messaging.channels::AMFChannel)#4
    eventPhase = 2
    faultCode = “Channel.Security.Error”
    faultDetail = “Error #2048: Violação da área de segurança: http://localhost/flexCRUD/flexCRUD.swf não pode carregar dados de http://flexCRUD/php/gateway.php. url: ‘http://flexCRUD/php/gateway.php'
    faultString = “error”
    reconnecting = false
    rejected = false
    rootCause = (flash.events::SecurityErrorEvent)#8
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::NetConnection)#7
    errorID = 0
    eventPhase = 2
    target = (flash.net::NetConnection)#7
    text = “Error #2048: Violação da área de segurança: http://localhost/flexCRUD/flexCRUD.swf não pode carregar dados de http://flexCRUD/php/gateway.php.
    type = “securityError”
    target = (mx.messaging.channels::AMFChannel)#4
    type = “channelFault”
    timestamp = 0
    timeToLive = 0

  9. bom dia Daniel, estou seguindo esse tutorial flexCRUD, e na execução , na parte 2, após clicar em OK para inserir o nome e email, está dando erro e nao faz a inserçao. Pode me dar uma luz? verifiquei o log de erros do php e seque abaixo:
    [Sat May 21 00:31:36 2011] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
    [Sat May 21 00:31:36 2011] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
    [Sat May 21 00:31:36 2011] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
    [Sat May 21 02:28:40 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Zend\\Db\\Adapter\\Pdo\\Mysql.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:28:40 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Zend\\Db\\Adapter\\Pdo\\Mysql.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:28:40 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Zend_Db_Adapter_Pdo_Mysql’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 8, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:41:26 2011] [error] [client 127.0.0.1] PHP Warning: include(base.php) [function.include]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:41:26 2011] [error] [client 127.0.0.1] PHP Warning: include() [function.include]: Failed opening ‘base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:41:26 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Base.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:41:26 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:41:26 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Base’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 5, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:59:34 2011] [error] [client 127.0.0.1] PHP Warning: include(base.php) [function.include]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:59:34 2011] [error] [client 127.0.0.1] PHP Warning: include() [function.include]: Failed opening ‘base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:59:34 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Base.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:59:34 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 02:59:34 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Base’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 5, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:00:57 2011] [error] [client 127.0.0.1] PHP Warning: include(base.php) [function.include]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:00:57 2011] [error] [client 127.0.0.1] PHP Warning: include() [function.include]: Failed opening ‘base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:00:57 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Base.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:00:57 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:00:57 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Base’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 5, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:04:20 2011] [error] [client 127.0.0.1] PHP Warning: include(base.php) [function.include]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:04:20 2011] [error] [client 127.0.0.1] PHP Warning: include() [function.include]: Failed opening ‘base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:04:20 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Base.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:04:20 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:04:20 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Base’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 5, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:27:31 2011] [error] [client 127.0.0.1] PHP Warning: include(base.php) [function.include]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:27:31 2011] [error] [client 127.0.0.1] PHP Warning: include() [function.include]: Failed opening ‘base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 2, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:27:31 2011] [error] [client 127.0.0.1] PHP Warning: include_once(Base.php) [function.include-once]: failed to open stream: No such file or directory in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:27:31 2011] [error] [client 127.0.0.1] PHP Warning: include_once() [function.include]: Failed opening ‘Base.php’ for inclusion (include_path=’.;C:\\php5\\pear’) in C:\\wamp\\www\\FlexCRUD\\php\\Zend\\Loader.php on line 146, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4
    [Sat May 21 03:27:31 2011] [error] [client 127.0.0.1] PHP Fatal error: Class ‘Base’ not found in C:\\wamp\\www\\FlexCRUD\\php\\pessoas.php on line 5, referer: http://localhost/flexCRUD/flexCRUD.swf/DYNAMIC/4

  10. Olá pessoal, estou tendo esse erro.
    Tentei entender, como sou noob tá dificil, poderiam ajudar?

    (mx.messaging.messages::ErrorMessage)#0
    body = (Object)#1
    clientId = (null)
    correlationId = “EDE9F966-165F-C840-1985-E87D7BD99A28″
    destination = “”
    extendedData = (null)
    faultCode = “Client.Error.DeliveryInDoubt”
    faultDetail = “Canal desconectado antes do recebimento da confirmação”
    faultString = “Canal desconectado”
    headers = (Object)#2
    messageId = “A50143AD-9A3F-C209-86C9-E87D7C4E88AA”
    rootCause = (mx.messaging.events::ChannelEvent)#3
    bubbles = false
    cancelable = false
    channel = (mx.messaging.channels::AMFChannel)#4
    authenticated = false
    channelSets = (Array)#5
    connected = false
    connectTimeout = -1
    enableSmallMessages = true
    endpoint = “http://localhost/CRUD/php/gateway.php”
    failoverURIs = (Array)#6
    id = “zend-endpoint”
    mpiEnabled = false
    netConnection = (flash.net::NetConnection)#7
    client = (mx.messaging.channels::AMFChannel)#4
    connected = false
    maxPeerConnections = 8
    objectEncoding = 3
    proxyType = “none”
    uri = (null)
    piggybackingEnabled = false
    polling = false
    pollingEnabled = true
    pollingInterval = 3000
    protocol = “http”
    reconnecting = false
    recordMessageSizes = false
    recordMessageTimes = false
    requestTimeout = -1
    uri = “php/gateway.php”
    url = “php/gateway.php”
    useSmallMessages = false
    channelId = “zend-endpoint”
    connected = false
    currentTarget = (mx.messaging.channels::AMFChannel)#4
    eventPhase = 2
    reconnecting = true
    rejected = false
    target = (mx.messaging.channels::AMFChannel)#4
    type = “channelDisconnect”
    timestamp = 0
    timeToLive = 0

  11. ola Daniel. Sou iniciante em Flex. Fiz tudo que o tutorial ensina. Não deu erro algum, porém não está inserindo registros no banco. O que pode estar acontecendo??
    Grato

  12. Boa tarde… finalizei a segunda parte em poucos minutos e está 100% funcional…

    Me desmistificou tudo… eu era fã de AMFPHP e agora sinceramente não vejo porque ficar com ele (Apesar de ser muito bom)… Zend Amf é muito mais top!!!

    parabéns pelo artigo…

Deixe um Comentário

O seu endereço de email não será publicado Campos obrigatórios são marcados *

*

Você pode usar estas tags e atributos de HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>